abort_handler_s

From Appmethod Topics
Jump to: navigation, search

Go Up to stdlib.h Index


Header File

stdlib.h

Category

Run-time constraint handling

Prototype

void abort_handler_s(const char * restrict msg, void * restrict ptr, errno_t error);

Description

abort_handler_s is a function that can be used as the parameter for the set_constraint_handler_s function. It outputs to stdout the string pointed to by msg, which is the name of the function where the constraint violation occurred.

After it outputs to stdout, abort_handler_s calls the abort function.

Return Value

abort_handler_s has no return value.

Example

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
    char* string = NULL;
    set_constraint_handler_s(abort_handler_s);
    gets_s(string, 5); //stdout: "gets_s"
    return 0;
}

See Also