Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 i = a / b;
cout << b << endl;//I want to check out whether b is zero. It seems the output cannot be found anywhere.
question from:https://stackoverflow.com/questions/16703835/how-can-i-see-cout-output-in-a-non-console-application

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
344 views
Welcome To Ask or Share your Answers For Others

1 Answer

To output a string to the debug console, use OutputDebugStringA. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa363362%28v=vs.85%29.aspx

To output variable values to the debug console, using std::ostringstream, the send the string to OutputDebugStringA.

Excessive output statements will cause the program to severly slow down. However, it is a good technique to catch things the debugger has a problem with, such as the actual child members when playing with base pointers.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...