在文件夹中有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;
}