🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #469

Re: fopen(f,"r") vs fopen(f,"rb") what's the diff?

#469
From: Lewis Perin
Date: Sat, 25 Jul 1992 19:57
22 lines
1178 bytes
In article <1992Jul25.175848.29166@unixg.ubc.ca> ochealth@unixg.ubc.ca (ochealth) writes:

   A number of UNIX programs I have ported to OS/2 using emx or gcc
   choke on binary files, unless I modify them.

   for example:
   f = fopen(name,"r") must be changed to f=fopen(name,"rb")
   etc.

   I was wondering just what happens when you don't open as binary.
   Will it return EOF when it sees ^Z or what?

That's been my experience; I'm in the middle of porting a giant UNIX app.

   This is sort of troubling to me, since EMX is desing to make
   porting UNIX easier  Was fopen changed to make it more compatible
   with OS/2 or what. From what I've read "r" and "rb" are handled the
   same in UNIX.

The way I read K&R's 2nd edition, emx is correct.

Cheers, Lew
Technical Details
Message-ID: <9207251957.AA12652@jed.cs.nyu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!cmcl2!JED.CS.NYU.EDU!m-lp9966

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!cmcl2!JED.CS.NYU.EDU!m-lp9966
From: m-lp9966@JED.CS.NYU.EDU (Lewis Perin)
Newsgroups: comp.os.os2.programmer
Subject: Re: fopen(f,"r") vs fopen(f,"rb") what's the diff?
Message-ID: <9207251957.AA12652@jed.cs.nyu.edu>
Date: 25 Jul 92 19:57:26 GMT
Sender: daemon@cmcl2.nyu.edu (Mr Background)
Organization: New York University
Lines: 22