I’m trying to figure out the difference between opening a file like:
fstream *fileName*("FILE.dat",ios::binary);
or
fstream *fileName*("FILE.dat",ios::out);
or
fstream *fileName*("FILE.dat",ios::binary | ios::out);
I found that all of these forms are identical: in all cases, the same output on the file is produced using either *fileName*<< or *fileName*.write().
ios::outopens the file for writing.ios::binarymakes sure the data is read or written without translating new line characters to and from\r\non the fly. In other words, exactly what you give the stream is exactly what’s written.