In Win32ProgramYou can use the outputdebugstring function to output debugging information. The output result can be viewed in the vsintegrated environment, or the result can be captured using the tool dbgview.exe. The original form of the function is as follows:
Outputdebugstring
The outputdebugstring function sends a string to the debugger for display.
Void outputdebugstring (
Lpctstr lpoutputstring
);
Parameters
Lpoutputstring
[In] pointer to the null-terminated string to be displayed.
Return values
This function does not return a value
Because the outputdebugstring parameter is a string, we hope to support variable parameters like printf in actual use. You can use the following method to achieve this effect:
Inline bool mydbgstr (lpcstr lpszformat ,...)
{
Va_list ARGs;
Int nbuf;
Tchar szbuffer [512];
Va_start (ARGs, lpszformat );
Nbuf = _ vsnprintf (szbuffer, sizeof (szbuffer) * sizeof (tchar), lpszformat, argS );
Assert (nbuf> 0 );
Outputdebugstring (szbuffer );
Va_end (ARGs );
}
ArticleSource: http://www.diybl.com/course/3_program/c++/cppsl/200866/122894.html
# Pragma optimize ("", off). Disable optimization.