Specifies the destination(s) for a specific report type generated by _CrtDbgReport and any macros that call _CrtDbgReport or _CrtDbgReportW, such as these macros (debug version only): _ASSERT, _ASSERTE, _RPT, and _RPTF.
int _CrtSetReportMode (
    int nRptType, 
    int fMode 
);
nRptType 
fMode 
nRptType. _CrtSetReportMode specifies _CrtDbgReport's output destination. Because the macros _ASSERT, _ASSERTE, _RPT, and _RPTF call _CrtDbgReport, _CrtSetReportMode specifies the output destination of text specified with those macros.
When _DEBUG is not defined, preprocessing removes calls to _CrtSetReportMode.
If you do not call _CrtSetReportMode to define the output destination of messages, then the following defaults are in effect:
The following table lists the report types defined in Crtdbg.h.
| Report type | Description | 
|---|---|
| _CRT_WARN | Warnings, messages, and information that does not need immediate attention. | 
| _CRT_ERROR | Errors, unrecoverable problems, and issues that require immediate attention. | 
| _CRT_ASSERT | Assertion failures (asserted expressions that evaluate to FALSE). | 
_CrtSetReportMode assigns the new report mode specified in fMode to the report type specified in nRptType and returns the previously defined report mode for nRptType. The following table lists available choices for fMode and the resulting behavior of _CrtDbgReport. crtdbg.h defines these options as bit flags.
| Report mode | _CrtDbgReport behavior | 
|---|---|
| _CRTDBG_MODE_DEBUG | Writes the message to the console output window. | 
| _CRTDBG_MODE_FILE | Writes the message to a user-supplied file handle. To define the specific file or stream to use as the destination, call _CrtSetReportFile. | 
| _CRTDBG_REPORT_MODE | Returns fMode for the specified nRptType:1   _CRTDBG_MODE_FILE2   _CRTDBG_MODE_DEBUG | 
Each report type can be reported using one, two, or three modes, or no mode at all. Therefore, you can have more than one destination defined for a single report type. For example, the following code fragment sends assertion failures to both a debug message window and to stderr:
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
In addition, you can separately control the reporting mode(s) for each report type. For example, you can send an nRptType of _CRT_WARN to an output debug string while displaying _CRT_ASSERT using a debug message window and sending to stderr, as previously illustrated.
On successful completion, _CrtSetReportMode returns the previous report mode(s)s for the report type specified in nRptType.
| Versions | Defined in | Include | Link to | 
|---|---|---|---|
| INtime 3.13 | intime/rt/include/crtdbg.h | crtdbg.h | clib.lib |