Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Newfound Ajarn

TCHAR* to WCHAR*

This topic is 5455 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

I'm using c++ and I need to cast a value in a TCHAR* (char*) to a WCHAR*. The normal typecast ((WCHAR*)strtchar) works when compiling, but doesn't work on runtime. Could someone please tell me how I can do this? Thank you in advance. [edited by - Newfound Ajarn on November 11, 2003 1:51:43 AM]

Share this post


Link to post
Share on other sites
Advertisement
TCHAR compiles differently depending on whether you have UNICODE defined for your project. If UNICODE is not defined, a TCHAR is the same as a char. If UNICODE is defined, then a TCHAR is a wchar_t.

Having said that, the conversion functions you are probably looking for are mbstowcs() and wcstombs() (MBS stands for ''multi-byte string'' and wcs is ''wide character string''). Look on msdn.microsoft.com for the exact arguments.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!