> Thanks. The corrupt file has 0d:0a where the original had 0a. I see
> the first occurence at byte 0x481 in those files.
> I'll investigate what to do on Win32, but if someone else knows
> offhand, plese tell us!
>From the MSDN CD's about _read():
_read returns the number of bytes read, which may be less than count
if there are fewer than count bytes left in the file or if the file
was opened in text mode, in which case each carriage return -
linefeed (CR-LF) pair is replaced with a single linefeed character.
Only the single linefeed character is counted in the return value.
The replacement does not affect the file pointer.
This implies the opposite of what we are seeing.... Weird
For _write() MSDN has this little gem for us in store:
If the file is opened in text mode, each linefeed character is replaced
with a carriage return - linefeed pair in the output. The replacement
does not affect the return value.
What I did find was _fdopen(). It can associate a FILE* to an open fd.
It has the normal parameters for fopen() ("a,r,w") but also "t" and "b"
for text and binary files... Maybe this helps ;-)
After that all data can be written with fwrite()....
--
Andreas Sikkema
andreas.sikkema@xxxxxxxxxxx
"Standing barefoot in a river of clues, most people would
not get their toes wet." - Brian Kantor in a.s.r.