Le Wed, 08 Feb 2006 09:15:53 -0800, roberts.noah a écrit :
More to the point, there is no difference. All files are "binary".
The difference between opening them in binary vs. text *mode* is that
text mode does some translations during IO operations and binary does
not. This happens in the software during runtime, it isn't a state
that is saved in the file or that can be tested.
The main concern is that I tried to make a program that can
replaces strings with other strings. This works well for ascii
files, but with binary files (and even if I read/write with
ios_base::binary), the result for binary files is corrupted:
the size of the newly created binary file is smaller and
could not be executed (even for simple strings with same
sizes).
I might not have used the best stuff to do that (I'm not an
expert in file programming

: I often use \0. I guess this
can become from that point.
Although I first wasn't interrested in replacing strings
from binary files I guess it could still be a good point if
I succeed to do so (as some figure that it's not possible
to detect if a file is a binary or not).