I think what you're seeing is the automatic line ending conversion. Windows tries to be different and incompatible with everything else, and uses carriage return + line feed for line endings (byte sequence 13 and 10).
If you open your files in binary mode it should work:
Code:
// ios::in and ios::out are implied with ifstream and ofstream
ifstream inputFile(inFile, ios::binary);
ofstream outputFile(outFile, ios::binary);
and if you ever do C-style I/O then you would add "b" to the file mode:
Code:
FILE* f = fopen("i.bin", "rb");
FILE* f = fopen("o.bin", "wb");