Hi i am having a problem copying data from 1 file to another heres is my code.
I am supposed to be using a class to pass the data across and manipulate it on the way, but i need to understand how to do this first. It compiles fine, then when i run the program nothing happens. 'Result.txt' isnt even created. Cheers for your help.Code:#include <iostream> #include <fstream> using namespace std; void copyfiles(ifstream& copyfrom, ofstream& copyto); int main() { ofstream outfile; ifstream infile; infile.open("dates.txt"); if (infile.fail()) { cout << "cudnt open" <<endl; exit (1); } outfile.open("results.txt"); if (outfile.fail()) { cout << "cudnt open" <<endl; exit (1); } copyfiles(infile, outfile); cout<<"done"<<endl; infile.close(); outfile.close(); return 0; } void copyfiles(ifstream& copyfrom, ofstream& copyto) { int date; date = copyfrom.get(); while ( ! copyfrom.eof()) { copyto.put(date); date = copyfrom.get(); } return; }