views:

42

answers:

2

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.

+3  A: 

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
+1  A: 

Options:

  1. Make your own class that logs to a file
  2. Create a list view or edit control, and append text to it
  3. Use OutputDebugString
  4. Create a console window
  5. Windows Event Tracing (not for general logging)
Adrian McCarthy