How to cout the std::basic_string

前端 未结 3 1962
眼角桃花
眼角桃花 2020-12-16 14:41

I am trying to cout a basic_string. But cout is throwing error. Can I know how to do that

3条回答
  •  失恋的感觉
    2020-12-16 14:52

    TCHAR is a winapi define for the character type used by your application. If you have the character set as multi-byte characters, it will be char. If you have it set to Unicode, it will be wchar_t.

    If it's wchar_t, you need to use std::wcout. Otherwise, just plain std::cout should be fine.

    Generally it helps to also explain what errors you're getting, but most likely you're trying to insert an std::basic_string into std::cout, and there probably isn't an operator<< overload for that.

提交回复
热议问题