How can I see cout output in a non-console application?

后端 未结 8 2154
醉话见心
醉话见心 2021-02-06 22:10

It seems rather tedious to output to debug window. Where can I find cout output if I am writing a non-console information ?

Like:

double          


        
8条回答
  •  清酒与你
    2021-02-06 22:46

    Yes, indeed, it's annoying.

    Here's how I do it :

    #define DBOUT( s )            \
    {                             \
    std::wostringstream os_;    \
       os_ << s;                   \
       OutputDebugStringW( os_.str().c_str() );  \
    }
    // example :    DBOUT("some text " << some_variable << "   some more text" << some_other_varaible << "\n");
    

提交回复
热议问题