在文件夹中有1.txt-99.txt,一共99个文件,我输入55,就会打开55.txt,同时复制到b.txt
#include<iostream> #include<fstream> using namespace std; int main(){ char fileName[20],suffix[]=".txt"; cin>>fileName; strcat(fileName,suffix); ifstream in(fileName,ios::binary); ofstream out("b.txt",ios::binary); char temp; while(in.peek()!=-1) { in.read(&temp,sizeof(temp)); out<<temp; } system(fileName); return 0; }
作者:a771948524 发表于2013-6-3 21:14:20 原文链接
阅读:24 评论:0 查看评论