在Linux系统中,进程通过执行系统调用exit()来终止自己。
exit()系统调用实例
#include <stdlib.h>
#include <stdio.h>
int main()
{
printf("this is a exit system call!\n");
exit(0);
printf("this sentence never be displayed!\n");
return 0;
}
另一个实例
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("this is a exit system call!\n");
printf("connect in buffer\n");
exit(0);
return 0;
}