C/C++调用DOS命令 Posted on 2019-05-29 | In C++ , 其他 | | Words count in article: 146 | Reading time ≈ 1 C/C++调用DOS命令 使用system(“…”);C要#include <stdlib.h>C++直接(只要iostream C:1234567891011#include <stdio.h>#include <stdlib.h>int main(){ //显示当前文件夹内容 system("dir"); //创建目录 system("mkdir philippian_test"); //在该目录中创建hehe.txt文件 system("touch philippian_test/hehe.txt"); return 0;} 1234567该程序,1. 显示当前文件夹内容2. 创建名字为“philippian_test”的文件夹(目录)3. 在该目录里面创建文件“hehe.txt” C++:123456#include <iostream>using namespace std;int main(int argc, char *argv[]){ system("date"); return 0;} 1用date命令显示当前日期: Donate? comment? Donate WeChat Pay Alipay