reduce characters from LPWSTR and save it as LPCWSTR
I have开发者_开发知识库 a string saved as LPWSTR. I have to make a change in this string (reduce some characters) and save it as LPCWSTR. How can i do it?
Thanks
An LPWSTR
is just a pointer to an array of WCHAR
s, which represent UTF-16 code units. Iterate through the characters, much like you would a char *
, making the change you need. You might want to edit your post and explain exactly what change you need...
An LPCWSTR
is just the const version of LPWSTR
. (A LPWSTR
is a WCHAR *
and a LPCWSTR
is a const WCHAR *
.)
An LPWSTR
can be modified (no C
in there). Just use std::remove_if()
or any other function you'd like. You can then simply const_cast<>
the pointer to a LPCWSTR.
精彩评论