The following program help to run a function upon the exiting the program
#include <stdlib.h>
#include <stdio.h>
/* Prototypes */
int fn1(void), fn2(void);
int main( void )
{
_onexit( fn1 );
_onexit( fn2 );
printf( "This is executed first.\n" );
}
int fn1()
{
system( "start /wait notepad" );
return 0;
}
int fn2()
{
system( "start /wait services.msc" );
return 0;
}
#include <stdlib.h>
#include <stdio.h>
/* Prototypes */
int fn1(void), fn2(void);
int main( void )
{
_onexit( fn1 );
_onexit( fn2 );
printf( "This is executed first.\n" );
}
int fn1()
{
system( "start /wait notepad" );
return 0;
}
int fn2()
{
system( "start /wait services.msc" );
return 0;
}
0 comments:
Post a Comment