在c ++中获取`wchar_t *'的长度 [英] get length of `wchar_t*` in c++
本文介绍了在c ++中获取`wchar_t *'的长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请问,我如何知道c ++中 wchar_t *
类型的变量的长度?
代码示例如下:
wchar_t * dimObjPrefix = Lretro_;
我想知道有多少字符 dimObjPrefix
包含
解决方案
sizeof(wchar_t);
编辑 / p>
我注意到 string
标签。如果您想知道 wchar_t
字符串( wchar_t *
)的大小,想要使用 wcslen(3)
:
size_t wcslen(const wchar_t * ws);
Please, how can I find out the length of a variable of type wchar_t*
in c++?
code example below:
wchar_t* dimObjPrefix = L"retro_";
I would like to find out how many characters dimObjPrefix
contains
解决方案
sizeof (wchar_t);
Edit:
I just noticed the string
tag. If you want to know the size of a wchar_t
string (wchar_t *
), you want to use wcslen(3)
:
size_t wcslen (const wchar_t *ws);
这篇关于在c ++中获取`wchar_t *'的长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文