windows - What exactly is a PWSTR and why use this naming compared to char*, std::string, or CString in C++? -


in various c++ code see different usage of strings: pwstr, char*, std::string, cstring, etc ...

when best time use pwstr compared other string type?

a pwstr wchar_t string pointer. unicode (usually ucs2) string each character taking 16 bits.

a char* pointer 8 bits per character. ascii, ansi, utf8, or 1 of many hundreds of other encodings. although need worry encodings if need string hold languages other english or special symbols.

in general, windows api unicode internally windows programmers use wchar strings. std::string , cstring can both unicode if right symbols #defined, choice between pwstr, std::string , cstring matter of preference or convention of codebase work with.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -