Visual Studio debugging techniques --- Output window Outputs

When using VC ++, often tend to use OutputDebugString Output window to write some debug information, if the output follow a certain format, then click on the appropriate output text in the Output window will jump to the corresponding line of code. MSDN has a specific format that is simple to say, in front of the text output is "file name (line number):" format on it. One example used in my memory leak detection code:

wsprintf(output_temp,"%s(%d): >>>>>>>>>>>>mem leaks! size=%d",
            memory_allocated[i].file, 
            memory_allocated[i].line,
            memory_allocated[i].size);
        OutputDebugString(output_temp);

Focus% s (% d): must be at the top, and the colon is not small. Of course, provided file and line must be correct, use the compiler to improve the __FILE__ and __LINE__ it.

Guess you like

Origin www.cnblogs.com/yilang/p/12468725.html