🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cs.forum
Article #4

Re: Help: a very segmentation fault!

#4
From: Dan Pop
Date: Mon, 15 Apr 1996 23:37
36 lines
2109 bytes
In <4kiptc$ih5@eng_ser1.erg.cuhk.hk> wkso@se.cuhk.hk (--- Sam ---) writes:


>: I've tried the program...  That's okay... except some syntax error...
>
>: One more thing...  What is your platform??  There's no "r+b" mode for
>: fopen on unix systems...  

Please don't post such idiocies.  "r+b" is a valid mode on any platform
supporting standard C, Unix included, as well as on most K&R C 
implementations, which simply discarded the 'b' at the end of the string.
"rb+" is problematic on pre-ANSI implementations, because it will be
interpreted as "r" and not as "r+", because anything following the
"spurious" 'b' will be discarded.  So, "rb+" and "r+b" are equivalent on
ANSI C platforms but "r+b" works on pre-ANSI platforms, as well.

>: Default mode is binary for all files.

Nonsense.  In standard C (no matter the platform), the default is text.
It just happen that there is no difference between text and binary on
Unix, but this doesn't mean that the default is binary.

>	Yes ! You don't need to add "b" under UNIX ! It's easier
>to do this assignment on UNIX platform !

Unix or not, the C language _requires_ the 'b' when dealing with binary
streams.  You can't tell which will be the next platform you'll have to
port your code to, and it's plain foolish to introduce an OS dependency
simply by omitting the 'b' in fopen.  This omission buys you _nothing_.

Dan
--
Dan Pop
CERN, CN Division
Email: danpop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
Technical Details
Message-ID: <danpop.829611475@news.cern.ch>
Path: arc1-ca.pugleaf.net!news.cern.ch!danpop
References: <4ki7gu$bgc@eng_ser1.erg.cuhk.hk> <4kinqm$hnt@eng_ser1.erg.cuhk.hk> <4kiptc$ih5@eng_ser1.erg.cuhk.hk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.cern.ch!danpop
From: danpop@mail.cern.ch (Dan Pop)
Newsgroups: cs.forum,cuhk.se.3420,comp.lang.c
Subject: Re: Help: a very segmentation fault!
Date: 15 Apr 96 23:37:55 GMT
Organization: CERN European Lab for Particle Physics
Message-ID: <danpop.829611475@news.cern.ch>
References: <4ki7gu$bgc@eng_ser1.erg.cuhk.hk> <4kinqm$hnt@eng_ser1.erg.cuhk.hk> <4kiptc$ih5@eng_ser1.erg.cuhk.hk>
NNTP-Posting-Host: ues5.cern.ch
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Newsreader: NN version 6.5.0 #7 (NOV)