c语言中,为什么以下程序直接按”Enter“也就是回车程序不结束?


 1 /*************************************************************************
 2     > File Name: system.c
 3     > Author: Mr.Yang
 4     > Purpose:演示system()函数
 5     > Created Time: 2017年05月19日 星期五 19时29分17秒
 6  ************************************************************************/
 7 
 8 #include <stdio.h>
 9 #include <stdlib.h>
10 
11 char input[40];
12 
13 int main(void)
14 {
15         while(1)
16         {
17                 printf("Input the desire system command,blank to exit:");
18                 fgets(input,40,stdin);
19                 if(input[0] == '\0')//检测是否是空字符,如果是,直接退出程序,但在linux上运行不退出?
20                 {
21                         exit(0);
22                 }
23                 else
24                 {
25                         system(input);
26                 }
27         }
28 
29         return 0;
30 }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM