Answer to Question #106 in C++ for alia

Question #106
How to copy from an existing file to another one in C++?
1
Expert's answer
2010-05-17T04:27:01-0400
#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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS