且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

cout字符串获取地址而不是值

更新时间:2023-02-18 20:03:29

对于宽字符,您需要使用wcout而不是cout.这样做:

You need to use wcout instead of cout for wide characters. Do this:

#ifdef UNICODE
    typedef wchar_t     TCHAR;
    #define TEXT(quote) L##quote
    #define COUT        wcout
#else
    typedef char        TCHAR;
    #define TEXT(quote) quote
    #define COUT        cout
#endif

然后:

TCHAR* test = TEXT("test");
COUT << test;