Install a function to be executed at a program's exit.
Compatibility:This function is compatible with the following targets:
|
|
#include <stdlib.h>
int atexit(void (*func) void));Parameters:
Parameters for this facility are:
#include <stdlib.h>
#include <stdio.h>
// Prototypes
void first(void);
void second(void);
void third(void);
int main(void)
{
atexit(first);
atexit(second);
atexit(third);
printf("exiting program\n\n");
return 0;
}
void first(void)
{
int c;
printf("First exit function.\n");
printf("Press return.\n");
// wait for the return key to be pressed
c = getchar();
}
void second(void)
{
int c;
printf("Second exit function.\n");
printf("Press return.\n");
c = getchar();
}
void third(void)
{
int c;
printf("Third exit function.\n");
printf("Press return.\n");
c = getchar();
}
Output:
Third exit function.
Press return.
Second exit function.
Press return.
First exit function.
Press return.
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000