www.delorie.com/djgpp/doc/libc/libc_52.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

atexit

Syntax

 
#include <stdlib.h>

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

Description

This function places the specified function func on a list of functions to be called when exit is called. These functions are called as if a last-in-first-out queue is used, that is, the last function registered with atexit will be the first function called by exit.

At least 32 functions can be registered this way.

Return Value

Zero on success, non-zero on error.

Portability

ANSI/ISO C C89; C99
POSIX 1003.2-1992; 1003.1-2001

Example

 
void exit_func()
{
  remove("file.tmp");
}

...
atexit(exit_func);
...


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004