Hi,
How can I convert QString to TCHAR? My codes below does not work.
TCHAR nameBuffer[256];
memset(nameBuffer, 0, sizeof(nameBuffer));
#if UNICODE
_tcscpy_s(nameBuffer, _countof(nameBuffer), userName.toUtf8());
#else
_tcscpy_s(nameBuffer, _countof(nameBuffer), userName.toLocal8Bit());
#endif
QString userName = "John Doe";
TCHAR nameBuffer[256];
memset(nameBuffer, 0, sizeof(nameBuffer));
#if UNICODE
_tcscpy_s(nameBuffer, _countof(nameBuffer), userName.toUtf8());
#else
_tcscpy_s(nameBuffer, _countof(nameBuffer), userName.toLocal8Bit());
#endif
To copy to clipboard, switch view to plain text mode
Bookmarks