I am starting to do some work with the Windows API. However, I noticed that you can not use functions like printf if you have a windowed application. What is the standard way of printing debug and logging information? Sorry if this is an obvious question.
Asked
Active
Viewed 1,425 times
4
-
Does this answer your question? [How do I print to the debug output window in a Win32 app?](https://stackoverflow.com/questions/1333527/how-do-i-print-to-the-debug-output-window-in-a-win32-app) – Armen Michaeli Oct 30 '19 at 17:32
2 Answers
6
I normally use OutputDebugString()
, the API is here. While running the application you can then view the output of this function with DebugView from SysInternals or in the Visual Studio output window while debugging.

linuxuser27
- 7,183
- 1
- 26
- 22
4
Options:
- Make your own class that logs to a file
- Create a list view or edit control, and append text to it
- Use OutputDebugString
- Create a console window
- Windows Event Tracing (not for general logging)

Adrian McCarthy
- 45,555
- 16
- 123
- 175
-
Adrian your answer is by far more complete, I think that you have not been chosen for the answer because an example is missing. – dlewin Apr 20 '12 at 09:06