출처 :  https://stackoverflow.com/questions/6384118/what-does-the-l-in-front-a-string-mean-in-c

 

What does the 'L' in front a string mean in C++?

this->textBox1->Name = L"textBox1"; Although it seems to work without the L, what is the purpose of the prefix? The way it is used doesn't even make sense to a hardcore C programmer.

stackoverflow.com


 
 

'L' means wchar_t, which, as opposed to a normal character, requires 16-bits of storage rather than 8-bits.

Here's an example:

"A"    = 41
"ABC"  = 41 42 43
L"A"   = 00 41
L"ABC" = 00 41 00 42 00 43

A wchar_t is twice big as a simple char.

In daily use you don't need to use wchar_t, but if you are using windows.h you are going to need it.

 

 

+ Recent posts