1 2 | #include<stdlib.h> void exit(int status); |
1 2 3 4 5 6 7 8 | /* exit_test1.c */ #include<stdlib.h> main() { printf("this process will exit!\n"); exit(0); printf("never be displayed!\n"); } |
1 2 3 | $gcc exit_test1.c -o exit_test1 $./exit_test1 this process will exit! |
1 2 | #include<unistd.h> void _exit(int status); |
1 2 3 4 5 6 7 8 | /* exit2.c */ #include<stdlib.h> main() { printf("output begin\n"); printf("content in buffer"); exit(0); } |
1 2 3 4 5 6 7 8 9 10 11 12 | $gcc exit2.c -o exit2 $./exit2 output begin content in buffer /* _exit1.c */ #include<unistd.h> main() { printf("output begin\n"); printf("content in buffer"); _exit(0); } |
1 2 3 | $gcc _exit1.c -o _exit1 $./_exit1 output begin |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |