Linux中运行c程序,与系统打交道

例一:system系统调用是为了方便调用外部程序,执行完毕后返回调用进程。

#include <stdio.h>
#include <stdlib.h>
main()
{
    printf("call ls return %d
",system("pstree -p"));
}

 gcc -o jingce jingce.c 编译成可执行文件

然后 ./jingce

原文地址:https://www.cnblogs.com/bluewelkin/p/4329218.html