摘要:
/* * 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 阅读全文
posted @ 2012-10-26 18:42
CodingMonkey
阅读(196)
评论(0)
推荐(0)
摘要:
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, 阅读全文
posted @ 2012-10-26 17:38
CodingMonkey
阅读(189)
评论(0)
推荐(0)

浙公网安备 33010602011771号