Reputation: 312
I am trying to convert an TCHAR* variable to a char* variable. I am doing this because it is a must, and also because I am curious as to how this conversion would be done. I would really appreciate if you could help me. I am an c++ beginner.
Thanks .
Upvotes: 2
Views: 5589
Reputation: 1942
A TCHAR is defined depending on your project settings. If your project is using multi-byte, it is already a char. If it's unicode, you would use WideCharToMultiByte to convert. You can do #ifdef UNICODE
to check if your project is multi-byte or unicode. i.e:
#ifdef UNICODE
// TCHAR is unicode, convert to char
WideCharToMultiByte(...)
#else
// TCHAR is already char, do nothing
#endif
Upvotes: 1