🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #9811

open vs. fopen

#9811
From: Brent Welch
Date: Tue, 20 Dec 1988 22:43
18 lines
1122 bytes
 ``you can call "open" with only the file name as the argument ...
   (I called it with "r" though)''

fopen and open take different parameters.

	open(filename, flag_bits, permissions)
	fopen(filename, flag_string)

The second argument to open is something like O_RDONLY, or
O_WRONLY|O_TRUNC, while the second argument to fopen is something like
"r", or "w".  The C language does no type checking so you can easily screw
up this way.  It is likely that the pointer value passed for "r" contained
the O_TRUNC bit...  [[ Use lint.  --wnl ]]

	Brent Welch
	University of California, Berkeley
	brent%sprite@ginger.Berkeley.EDU
Technical Details
Message-ID: <8812131653.AA729422@sprite.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!husc6!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!husc6!rice!sun-spots-request
From: brent%sprite.Berkeley.EDU@ginger.berkeley.edu (Brent Welch)
Newsgroups: comp.sys.sun
Subject: open vs. fopen
Message-ID: <8812131653.AA729422@sprite.Berkeley.EDU>
Date: 20 Dec 88 22:43:58 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 18
Approved: Sun-Spots@rice.edu
Original-Date: Tue, 13 Dec 88 08:53:30 PST
X-Sun-Spots-Digest: Volume 7, Issue 66, message 4 of 10