环境:Vmware Workstation;CentOS-6.4-x86_64
说明:
1、system函数的定义形式:int system(const char *command);
2、system函数的参数是Linux系统下可以执行的命令。
程序如下:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *args[])
{
// 打开日历
system("cal");
// 查看文件
system("ls");
return 0;
}
执行效果:
[negivup@negivup mycode]$ gcc -o main main.c
[negivup@negivup mycode]$ ./main
九月 2015
日 一 二 三 四 五 六
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
main main.c
最后
以上就是优秀八宝粥最近收集整理的关于Linux下执行C语言函数system的全部内容,更多相关Linux下执行C语言函数system内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复