Anne Nonimus
Anne Nonimus

Reputation: 669

Printing debug output in Windows programs

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.

Upvotes: 4

Views: 1802

Answers (2)

linuxuser27
linuxuser27

Reputation: 7353

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.

Upvotes: 6

Adrian McCarthy
Adrian McCarthy

Reputation: 48019

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)

Upvotes: 4

Related Questions