1.函数原型:
*int system(const char command);
参数说明:
- command:外部可执行程序名字
返回值:成功,则返回进程的状态值。当在调用/bin/sh时失败则返回127,其他原因失败返回-1
2.system和exec族函数的区别:
- 调用exec族函数以后,它会代替调用它的程序,执行完成后,不会回到之前的程序中去
- system函数不同,调用了system之后,之前的程序会等待system的返回,返回之后继续执行之前的程序
demo:
#include <stdio.h>
#include <stdlib.h>
#include