MSC 5.0 Bug???

gordan gordan at maccs.UUCP
Mon Feb 8 20:32:43 AEST 1988


In article <11677 at brl-adm.ARPA> C03601DM%WUVMD.BITNET at CUNYVM.CUNY.EDU (Derek Morgan) writes:
-Is anybody aware of a bug in the fwrite() routine of MSC 5? If not, then
-either I found one (highly unlikely), or my program is screwed up in some
-subtle way (Extremely probable)...

Perhaps your problem has something to do with the fact that newline is
two characters (CR LF) in MS-DOS, while C prefers it to be a single
character ('\n').

I think operating systems like MS-DOS use low-level routines to
automatically map between CR LF <--> '\n' if you open a file as a text
file.  However this can have counterintuitive results, e.g. if you do
     ftell (...)
     fread (N bytes)
     ftell (...)
your position in the file as reported by ftell will not necessarily have
been incremented by exactly N, due to the translation of two bytes into
one for CR LF.

Disclaimer: it's 5:30 am.  Any resemblance to fact is purely coincidental.



More information about the Comp.lang.c mailing list