MFC learning the character set

MessageBox (L "aaa");
// why can it?
// Because for Chinese or other languages, a character corresponding to a plurality of bytes, this is called byte wide, e.g. unicode, utf-8 (3 th), GBK (two)
// "AAA" We L it can be converted to wide byte
// select the file, right-click, select properties, then select the character set, which we can see that we are using the unicode (wide bytes)
// TEXT use TEXT because you can converts any byte to byte we use, the adaptive code conversion
// TCHAR adaptive coding


Statistical string length //
// 1, the length of the multi-byte character string count
int NUM = 0;
char * P = "AAAA";
NUM = strlen (P);
// 2, a length byte wide statistics
Q = L * wchar_t "BBBBBB";
NUM = wcslen (Q);

// char *, conversion between CString
// char * -> CString
char * P1 = "AAAAA";
CString STR = CString (P1); // configuration parameters have

// CString -> char *
CStringA tmp;
tmp = str;
char * PP = tmp.GetBuffer ();
// char * string in C ++ and how conversion?
//. c_str ()

Guess you like

Origin www.cnblogs.com/sunflowers-lanqijiu/p/11785341.html