Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Specifies the action to be taken when a program aborts.

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 aborted. The message states in English that the application has requested the runtime to terminate it in an unusual way and suggests that the user contact the application's support team for more information. The default behavior is to print the message. _CALL_REPORTFAULT, if set, specifies that a Watson crash dump is generated and reported whenabort is called. Crash dump reporting is enabled by default.


Required header



For more compatibility information, see Compatibility in the Introduction.

// crt_set_abort_behavior.c
// compile with: /c
#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.


© 2016 Microsoft