Several types of debugging VC have been used in the recent section.Program. The general program will certainly use these methods.
The following is a summary:
1. Use trace to print the trace to the debugging window in the debug version of VC.
The limitation is that debugging cannot be performed without the VC environment. Only program writer for debugging.
2. Use the Microsoft Tracing Tool dbgview.exe to view the trace output, which can be separated from the VC environment.
The difference between this method and the first method is that the program can use trace to print messages independently from the VC environment. The user can be program tester to capture the logs of program errors for programmers to analyze the causes.
To some extent, this expands the scope of use of trace.
3. Embed code in the Code and output the trace to the file.
This is the most troublesome. You need to add Code specifically recording the running status of your program, and finally record these logs to the file code. In fact, this is not troublesome. I posted an article on this topic, . Implements a simple class to output trace to a file. It is easy to use and has little code.
This can be done by the customer for product testing. You cannot ask the customer to open dbgview to capture the log, but you can ask the customer to send the log file on the computer to you. Therefore, you can use this method to save the problems that occur during the program running. The customer's environment, operations, and other reasons may affect the program. Therefore, it is best to look at this log file to analyze the problem.
The first two benefits are that you do not need to change the code for debugging. Just use trace.