For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Specifies the action to be taken when a program is abnormally terminated.

System_CAPS_ICON_note.jpg Note

Do not use the abort function to shut down a Windows 8.x Store app, except in testing or debugging scenarios. Programmatic or UI ways to close a Windows 8.x Store app are not permitted according to the Windows 8 app certification requirements. For more information, see Application lifecycle (Windows Store apps).

unsigned int _set_abort_behavior(  
   unsigned int flags,  
   unsigned int mask  


[in] flags
New value of the abort flags.

[in] mask
Mask for the abort flags bits to set.

The old value of the flags.

There are two abort flags: _WRITE_ABORT_MSG and _CALL_REPORTFAULT. _WRITE_ABORT_MSG determines whether a helpful text message is printed when a program is abnormally terminated. The message states that the application has called the abort function. The default behavior is to print the message. _CALL_REPORTFAULT, if set, specifies that a Watson crash dump is generated and reported when abort is called. By default, crash dump reporting is enabled in non-DEBUG builds.

RoutineRequired header

For more compatibility information, see Compatibility.

      // crt_set_abort_behavior.c  
// compile with: /TC  
#include <stdlib.h>  
int main()  
   printf("Suppressing the abort message. If successful, this message"  
          " will be the only output.\n");  
   // Suppress the abort message  
   _set_abort_behavior( 0, _WRITE_ABORT_MSG);  
Suppressing the abort message. If successful, this message will be the only output.