This message was edited by stober at 2006-5-15 17:43:48
I don't see the problems with binary i/o that are mentioned in the article you posted. If you use VC++ 2005 express, open a text file in binary mode then read the entire file into one huge buffer. After it is read, use the debugger to view all the bytes in the file -- you will notice that the data in the buffer is an exact copy of the data on the file. ifstream did not change the file one byte.
If you still don't believe it, compile and run this program with your compiler -- it writes and reads a true binary file, not mearly a text file treated as binary.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
long a = 123;
long b = 456;
float c = 234.456f;
ofstream out("myfile.dat",ios::binary);
out.write((char *)&a,sizeof(long));
out.write((char *)&b,sizeof(long));
out.write((char *)&c,sizeof(float));
out.close();
a = b = 0;
c = 0.0;
ifstream in("myfile.dat", ios::binary);
in.read((char *)&a,sizeof(long));
in.read((char *)&b,sizeof(long));
in.read((char *)&c,sizeof(float));
in.close();
cout << "a = " << a << "\n";
cout << "b = " << b << "\n";
cout << "c = " << c << "\n";
return 0;
}