摘要:
/* * simple fork usage */
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h> int main()
{ pid_t child; if ((child = fork()) == -1) { perror("fork"); exit(EXIT_FAILURE); } else if(child == 0) { puts("in child"); printf ("\tchild pid = %d\n", get 阅读全文
摘要:
system函数声明为: int system(const char *string);
string为你要输入的命令。 实例如下:
/* * Demonstrate the system() call */
#include <stdio.h>
#include <stdlib.h> int main()
{ int retval;//retval is the return value of the system call retval = system("ls -l"); if(retval == 127) { fprintf(stderr, 阅读全文