c++ - Windows NT binary executable file internal const string encoding -
windows nt uses unicode (two bytes wide utf-16) default encoding method throughout windows nt api. if choose use ascii or multibyte character set default character set, transform ascii unicode. , use ascii character set slower unicode. transform mean? transform ascii api unicode api or transform strings? example: if create c/c++ file const char* text = "hello, world!"
. when compile on windows nt, compiled binary file store "hello, world!" unicode (26 bytes) or ascii (13 bytes)?
you have decide api version use: ansi or unicode. either use functions explicitly (like createfilea ansi, resp. createfilew unicode) or use function name without 'a' or 'w' , _unicode preprocessor variable decides of 2 functions used. functions require structs contain strings. there 2 versions of these structs (like osversioninfoa , osversioninfow). there no reason ansi nowadays.
but applies arguments, not content. if write string file using pointer data , size, no translation taking place.
to answer question: since explicitly used char
takes 13 bytes. if you'd used wchar
use 26 bytes. have written const tchar* text = _t("hello world!");
, _unicode decide.
Comments
Post a Comment