I need to find a way to convert char[] to TCHAR[]

I did my best to find it, but all I could find was char[] to wchar_t[]

using...

int swprintf( wchar_t *buffer, const wchar_t *format [, argument] ... );

Help please!

Well, I did this:

char myCharVar[MAX_CHAR];
(TCHAR)myCharVar

I know this is not a very good practice, but I couldn't find a better wayand I am in a hurry with this program...

TCHAR is a macro that is defined to be char* if UNICODE is not defined, or wchar_t if UNICODE is defined. If you want to convert from char* to wchar_t* regardless of UNICODE definition then you can not use the TCHAR macro. one data type can not be converted to the other by simply typcasting -- you must use one of the convertion functions, such as this one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.