Trace macro for VCProgramDebugging is very useful and has functions similar to printf;
This macro only appears in the debug version of the program. When release is used, the macro disappears completely, helping you reduce the number of debugging tasks during release.CodeQuantity.
Trace ("ddddddddddd"); trace ("Wewe % d", 333); trace0, trace1, and trace2 also exist... Corresponding to 0, 1, 2, respectively .. Parameter trace information is output to the output window of the vc ide environment (this window is the one that prompts an error in your compilation project), but it is limited to running your debug version program in VC.
Trace information can also be captured using debugview. In this case, you cannot run your program in the vc ide environment, but run the build debug version program separately, at this time, you can see the output in the debugview format in the debugview window.
There are four trace usage methods in VC:
1: trace, that is, the output string without dynamic parameters, similar to C's printf ("output string ");
2: The trace string can contain a parameter output, similar to C's printf ("... % d", variable );
3: trace can contain two parameter outputs, similar to C's printf ("... % d... % F", variable 1, variable 2 );
4: trace can contain three parameter outputs, similar to C's printf ("... % d, % d, % d", variable 1, variable 2, variable 3 );
The trace macro is like the printf function we used in the C language before, so that the program outputs some debugging information during the running process, so that we can understand some of the program status. The difference is that the trace macro outputs only in the debugging status, and the printf function used previously has output in any situation.
Like the printf function, the trace function can accept multiple parameters, such as: int x = 1; int y = 16; float z = 32.0; trace ("this is a trace statement \ n"); trace ("the value of X is % d \ n", X ); trace ("x = % d and Y = % d \ n", x, y ); trace ("x = % d and Y = % X and Z = % F \ n", x, y, z); note that the trace macro only applies to debug
The project of the release version has a function. In the project of the release version, the trace macro is ignored.