Where can I see printf output in an mfc application during debugging?
Is there a "console" window I can view in the debugger?
(Visual Studio C++ 6.0)
Thanks.
Where can I see printf output in an mfc application during debugging?
Is there a "console" window I can view in the debugger?
(Visual Studio C++ 6.0)
Thanks.
I used to use the TRACE family of macros
TRACE0
, TRACE1
,... etc
They behave like the printf. The 0, 1, 2,... etc suffices specify the number of arguments the macro can take (printf uses a va_list open number of argument)
If you use the API OutputDebugString, the strings you output will appear in the Visual C Output window (in debug mode). In release mode, you'll need a separate app to capture them, such as DBWIN32.EXE
The advantage of using a separate application is that you can get debug output from several applications serialised into a single window, which can be very handy for debugging some scenarios.
The downside of course is that you can get debug output from other apps (nothing to do with your own) appearing because they've forgotten to flag out their debug in the release build. TRACE will do this automatically, but of course there might be cases where you WANT to get at the output in the release build. I prefer to be in charge, so I wsprintf/sprintf into a string, use OutputDebugString, and retain that control for myself.