Ich frage mich, wie ich C++ ifstream/ofstream verwenden, um eine Datei zu kopieren und als einen anderen Namen zu speichern.C++ Kopieren einer anderen Datei
das ist so weit wie ich habe. Ich weiß, wie man die Datei bekommt, nur dass ich nicht weiß, wie ich diese Datei kopieren und als einen anderen Namen speichern soll.
#include<iostream>
#include<fstream>
#include<string>
namespace std;
int main()
{
ofstream
ifstream
cout << "enter your file you want to copy"<< endl;
cin >> input_file_name;
in_file.open(input_file_name);
if (!in_file)
{
cout <<" there is no such file"<<endl;
return 0;
}
cout <<" enter the name you want to save this copy file"<<endl;
cin >> output_file_name;
out_file.open(output_file_name);
if (!out.file)
{
cout<<"file is not available"<<endl;
return 0;
}
in_file.close();
out_file.close();
return 0;
}
http://coliru.stacked-crooked.com/a/be544185115d1b42 – sehe