c++windowsinttchar

C++ windows how to convert 'unsigned int' to 'TCHAR *'?


I am in new to C++ on windows. Can you please tell me how to convert unsigned int to TCHAR *?


Solution

  • Maybe you want to convert a unsigned int to a string. You can use std::to_wstring if TCHAR is defined as a WCHAR:

    unsigned int x = 123;
    
    std::wstring s = std::to_wstring(x);
    

    Then convert s.c_str() to a TCHAR*.

    Also you should take a look to MultiByteToWideChar.