Archived

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

TCHAR* to WCHAR*

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