设为首页收藏本站 |天气与日历| 2025-07-01 星期二 06:45:00 (建党节) 乙巳(蛇)年 六月初七 卯时
     
切换到窄版

私人站点

 找回密码
 立即注册
搜索
查看: 209|回复: 0

system函数的使用

[复制链接]

954

主题

954

帖子

3879

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
3879
发表于 2021-12-7 12:23:44 | 显示全部楼层 |阅读模式
文件头:#include <stdlib.h>
int system(const char *command);
功能:在已经运行的程序中执行另外一个外部程序
参数:外部可执行程序名字
返回值:
成功:0
失败:任意数字

示例代码:
#include <stdio.h>
#include <stdlib.h>
int main()
{
        //system("calc"); //windows平台
        system("ls"); //Linux平台, 需要头文件#include <stdlib.h>
        return 0;
}

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|编程站点 ( 冀ICP备2023028127号-2 )|友链申请|

GMT+8, 2025-7-1 06:45 , Processed in 0.099657 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表