无忧启动论坛
标题:
~写入重定向到其他盘
[打印本页]
作者:
qq14667696
时间:
2018-10-15 22:49
标题:
~写入重定向到其他盘
本帖最后由 qq14667696 于 2018-10-17 15:19 编辑
批处理/其他编程语言,怎么写入重定向到其他盘?
——网上c++方法
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ofstream file("C:/cdp_test_in.txt");
file << "china, china." << endl;
file << "hello, world." << endl;
file << "great, anhui." << endl;
file.close();
FILE *newIn = NULL, *newOut = NULL;
freopen_s(&newIn, "C:/cdp_test_in.txt", "r", stdin);
freopen_s(&newOut, "C:/cdp_test_out.txt", "w", stdout);
char buffer[20];
while(gets(buffer))
puts(buffer);
if(newIn)
fclose(newIn);
if(newOut)
fclose(newOut);
return 0;
}
执行完毕后可以在C:目录下找到那两个文件
作者:
nttwqz
时间:
2018-10-15 23:07
其他编程语言?
你这个貌似代表了目前出现的所有编程语言,最起码是流行的变成语言。。。
作者:
2012masterasia
时间:
2018-10-16 08:48
操纵系统本身带 link 啊,什么的
作者:
2201480548
时间:
2018-10-16 09:22
666
欢迎光临 无忧启动论坛 (http://bbs.wuyou.net/)
Powered by Discuz! X3.3