Tracks an application's progress by generating a debug report (debug version only). The
n suffix specifies the number of arguments in
args, and can be 0, 1, 2, 3, 4, or 5.
Format-control string used to create the user message.
Substitution arguments used by
All these macros take the
format parameters. In addition, they might also take up to four more arguments, signified by the number appended to the macro name. For example,
_RPTF0 take no more arguments,
arg2, and so on.
_RPTF macros are similar to the
printf function, because they can be used to track an application's progress during the debugging process. However, these macros are more flexible than
printf because they don't need to be enclosed in #ifdef statements to prevent them from being called in a retail build of an application. This flexibility is achieved by using the
_DEBUG macro; the
_RPTF macros are only available when the
_DEBUG flag is defined. When
_DEBUG isn't defined, calls to these macros are removed during preprocessing.
_RPTFW macros are wide-character versions of these macros. They are like
wprintf and take wide-character strings as arguments.
_RPT macros call the
_CrtDbgReport function to generate a debug report with a user message. The
_RPTW macros call the
_CrtDbgReportW function to generate the same report with wide characters. The
_RPTFW macros create a debug report with the source file and line number where the report macro was called, in addition to the user message. The user message is created by substituting the
arg[n] arguments into the
format string, using the same rules defined by the
_CrtDbgReportW generates the debug report and determines its destinations based on the current report modes and file defined for
_CrtSetReportFile functions are used to define the destinations for each report type.
_RPT macro is called, and
_CrtSetReportFile haven't been called, messages are displayed as follows:
|Warning text isn't displayed.
|A pop-up window. Same as if
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); had been specified.
When the destination is a debug message window and the user chooses the Retry button,
_CrtDbgReportW returns 1. This return value causes these macros to start the debugger, if just-in-time (JIT) debugging is enabled. For more information about using these macros as a debugging error handling mechanism, see Macros for reporting.
Two other macros exist that generate a debug report. The
_ASSERT macro generates a report, but only when its expression argument evaluates to
_ASSERTE is exactly like
_ASSERT, but includes the failed expression in the generated report.
For more compatibility information, see Compatibility.
Debug versions of C run-time libraries only.
Although these macros are available when you include
crtdbg.h, to run, the application must link with one of the debug libraries, because these macros call other run-time functions.
See the example in the