1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| #include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
std::string my_file("/home/ahlem/Bureau/monfichier.txt");
std::fstream file_p(my_file.c_str(), std::ios::in);
std::string my_file1("/home/ahlem/Bureau/capture.txt");
std::fstream file1_p(my_file1.c_str(), std::ios::out | std::ios::app);
file1_p<<file_p.rdbuf();
ofstream objetfichier;
objetfichier.open("/home/ahlem/Bureau/tonfichier.txt", std::ios::out);
objetfichier<<file1_p.rdbuf();
file_p.close();
file1_p.close();
objetfichier.close();
cout << "la copie est terminée :)";
return 0;
} |
Partager