- Nov 2, 2004
- 1,460
- 2
- 81
I written a small program, something to get me back into c++ and just wanted to fool around, to take one file and append it to another file. What I've done is taken to files that are the same(data and size) and just appended one to the other. When I did this however I get one extra byte on the file being appended to.
here is how im opening the files
myfile1.open(file1.c_str(), ios::in | ios::ate | ios::binary);
myfile2.open(file2.c_str(), ios:
ut | ios::binary);
here is where im appending the files
if (myfile2.is_open())
{
while (!myfile2.eof())
{
myfile2.get(ch);
myfile1.put(ch);
}
myfile1.close();
myfile2.close();
}
No clue where the extra byte is coming from.
thanks in advance.
here is how im opening the files
myfile1.open(file1.c_str(), ios::in | ios::ate | ios::binary);
myfile2.open(file2.c_str(), ios:
here is where im appending the files
if (myfile2.is_open())
{
while (!myfile2.eof())
{
myfile2.get(ch);
myfile1.put(ch);
}
myfile1.close();
myfile2.close();
}
No clue where the extra byte is coming from.
thanks in advance.