66 840
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #106 in C++ for alia

Question #106
How to copy from an existing file to another one in C++?
Expert's answer
#include <fstream>
#include <iostream>
#include <string>
using namespace std;

int main()
{
string a;

fstream inputFile("C:\\TEMP\\samp1.txt");
fstream outputFile;
outputFile.open("C:\\TEMP\\samp2.txt");

while (!inputFile.eof()) {
inputFile >> a;
outputFile << a << endl;

}
outputFile.close();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions