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
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);
Assuming that you want to get the length of null terminated C style string, you have two options:
#include <cwchar>
and use std::wcslen (dimObjPrefix);
,#include <string>
and use std::char_traits<wchar_t>::length (dimObjPrefix);
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With