Jump to content
  • Advertisement
Sign in to follow this  
noxy

wchar_t question.

This topic is 2505 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my book called symfonia c++ author wrote:

wchar_t a;
a = L'b;


Does it mean that i must put (L) always before ('b') etc.?
I dont understand quite diffrent bettween L'b' and 'b'.

Share this post


Link to post
Share on other sites
Advertisement
'b' is a regular char literal. Prefixing it with L makes it a wide character literal. The same deal with quotes. "b" is a regular char string. L"b" is the wide character string with equivalent contents.

Share this post


Link to post
Share on other sites

when you write L you convert 16 bit your char

No, it's not necessarily 16-bits. Most *nix systems use 32-bit wide characters.

Share this post


Link to post
Share on other sites
No, L is only used to prepend character literals and string literals to turn them into wide character literals and wide string literals. If you have a wchar_t variable you can assign it to another wchar_t variable without needing to use L on that assignment.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!