Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!uflorida!gatech!udel!mmdf From: Leisner.Henr@xerox.com (marty) Newsgroups: comp.os.minix Subject: Re: fopen: "r" |/& "rb"? (was Re: utility to find strings in a Message-ID: <9198@louie.udel.EDU> Date: 20 Feb 89 14:47:57 GMT Sender: mmdf@udel.EDU Lines: 34 in article <659@mks.UUCP>, wheels@mks.UUCP (Gerry Wheeler) says: >> fopen(argv[arg], "rb") > > This prevents DOS from returning EOF when it reads a ^Z character. When doing handle I/O, I don't think the cntl-Z character is used (read works with file sizes). I'm now running the Minix stdio routines on Ms/Dos. I added to FILE a flag for binary mode (to go along with the "*b" option in fopen) -- at the end of getc.c I have: /* filter out returns */ if(result == '\r' && !testflag(iop, BINMODE)) return getc(iop); else return result; In putc.c, I have: if(ch == '\n' && !testflag(iop, BINMODE)) putc('\r', iop); /* ms/dos patch ? */ The fact that the C library needs to do the filtering is a real pain. If the application is processing binary data through the stdio library, the ANSI way of doing it requires the "b" mode. marty ARPA: leisner.henr@xerox.com GV: leisner.henr NS: martin leisner:wbst139:xerox UUCP: hplabs!arisia!leisner