hi guys, maybe i'm complete idiot but i really can't see what's wrong with this: Code: ifstream fin("data.pdf"); ofstream fout("bleah.pdf"); fin.seekg (0, ios::end); int length = finc.tellg(); fin.seekg (0, ios::beg); for(int i=0;i<length;i++){ fout.put(fin.get()); } please excuse pointless function of this programm, it's just a model of what is my problem. The length is always correct, but the final file on the output is never complete copy. At some point it changes the eof and fail bit to true and the rest of the data read are just 0xFF bytes. :cryin: :cryin:
Try doing it this way : Code: ifstream fin("data.pdf"); ofstream fout("bleah.pdf"); char ch; fin.seekg (0, ios::end); unsigned int length = fin.tellg(); fin.seekg (0, ios::beg); while((ch=fin.get())!=EOF) fout.put(ch);