It depends. If you have not defined _UNICODE or UNICODE , you can create a string containing this character, like this:
const TCHAR example = _T('Q'); std::string mystring(1, example);
If you use _UNICODE and UNICODE , then this approach may work, but the character cannot be converted to char . In this case, you will need to convert the character to a string. Usually you need to use a call like wcstombs or WideCharToMultiByte , which gives you more control over the encoding.
In any case, you will need to allocate a buffer for the result and build std::string from this buffer, not forgetting to free the buffer after completion (or use something like vector<char> to make this happen automatically).
source share