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

后端 未结 8 2168
醉话见心
醉话见心 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:43

    For a Windows solution, you can allocate a console, and bind cout/cin to it. For example:

    AllocConsole();
    freopen("CONOUT$", "w", stdout);
    freopen("CONOUT$", "w", stderr);  
    

    Documentation:
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms681944%28v=vs.85%29.aspx

提交回复
热议问题