BYTE name[1000];
In my visual c++ project there is a variable defined name with the BYTE data type. If i am not wrong then BYTE is equivalent to unsigned char. Now i want to convert this unsigned char * to LPCTSTR.
How should i do that?
LPCTSTRis defined as eitherchar const*orwchar_t const*based on whetherUNICODEis defined or not.If
UNICODEis defined, then you need to convert the multi-byte string to a wide-char string usingMultiByteToWideChar.If
UNICODEis not defined, a simple cast will suffice:static_cast< char const* >( name ).This assumes that
nameis a null-terminated c-string, in which case defining itBYTEwould make no sense. You should useCHARorTCHAR, based on how are you operating onname.