NAME

atexit - register a function to run at process termination

SYNOPSIS

#include "zkStdlib.h"

int atexit(void (*func)(void));

DESCRIPTION

The atexit() function registers the function pointed to by func to be called without arguments. At normal process termination, functions registered by atexit() are called in the reverse order to that in which they were registered. Normal termination occurs either by a call to exit() or a return from main().

At least 32 functions can be registered with atexit().

After a successful call to any of the exec functions, any functions previously registered by atexit() are no longer registered.

RETURN VALUE

Upon successful completion, atexit() returns 0. Otherwise, it returns a non-zero value.

ERRORS

No errors are defined.

APPLICATION USAGE

The functions registered by a call to atexit() must return to ensure that all registered functions are called.

There is no way for an application to tell how many functions have already been registered with atexit().