#include fstream
usingnamespace std;
//totally just wrote this code in this forum text box
// there could be syntax errors
void copy()
{
ifstream fileIn;
fileIn.open("old.txt");
ofstream fileOut;
fileOut.open("new.txt");
string temp;
while(! fileIn.eof())
{
fileIn.getline(temp);
fileOut >> temp;
}
fileIn.close();
fileOut.close();
}
Not really, reading one line at a time. Especially if there is no new line characters used. Nor using the input operator.
Reading till buffer full is a little better, but there could be a fair number of optimization improvements you could do. I'd suggest just use a file manipulation library to handle this for you.
I have thought about using the system command, but I'm planing in implemented in a win32 gui program, and I don't want the good ole console to be popping up. Which is what I think will happen(could be wrong though).
Ok I tried to do what everyone here said and use the CopyFile function in the windows API, but Im having a little trouble getting it to compile. Here's what I have.