How to convert TCHAR to char
C / C++ / MFC
4
Posts
4
Posters
0
Views
1
Watching
-
char *pAnsiString = new char[nSize+1]; wcstombs(pAnsiString, wcpString, nSize+1);
-
Do you have a unicode string, or a TCHAR string? If it's a TCHAR, use the ATL
T2A()
macro, as it will work correctly regardless of whether you're compiling for unicode or not. If it's a true unicode string (using WCHAR), use theWideCharToMultiByte()
function.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"