有人可以帮助这个简单的程序提示用户输入命令吗?
#include "unistd.h"
#include "stdio.h"
int main(){
char command[80];
while (putchar('#'), gets(command)) {
if (fork()){
wait(0); /* Parent */
}
else { /* Child */
execlp(command, command, 0);
printf("command not found\n");
exit(1);
}
}
}
给出的命令:gcc system.c -o system.exe
错误如下:
system.c: In function ‘main’:
system.c:12:7: warning: missing sentinel in function call [-Wformat]
system.c:14:7: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]