🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #4096

Re: Turbo C and ^Z's

#4096
From: Karl Heuer
Date: Fri, 04 Jan 1991 17:39
16 lines
1291 bytes
In <OTTO.91Jan4115449@tukki.jyu.fi> otto@tukki.jyu.fi (Otto J. Makela) writes:
>In <10251@hydra.Helsinki.FI> wirzeniu@cs.Helsinki.FI (Lars Wirzenius) writes:
>>"a" means that all writes happen at the end of the file, use "r+b" instead.
>
>ALL WRITES ?  Come on, the first thing I do after that is to seek the file...

Lars is correct.  On a file opened in append-mode, fseek() is only useful for
reading.  (Though some historical implementations implemented append-mode with
an initial seek-to-end only, this is not acceptable in ANSI C.)

>I'd like to point out I can't use "r+b", 'cause it'll fail if the file does
>not exist beforehand.

Then use "w+b".

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
Technical Details
Message-ID: <1991Jan04.173903.20643@dirtydog.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!spdcc!ima!dirtydog!karl
References: <OTTO.91Jan3125711@tukki.jyu.fi> <10251@hydra.Helsinki.FI> <OTTO.91Jan4115449@tukki.jyu.fi>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think.com!mintaka!spdcc!ima!dirtydog!karl
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.os.msdos.programmer,comp.lang.c
Subject: Re: Turbo C and ^Z's
Message-ID: <1991Jan04.173903.20643@dirtydog.ima.isc.com>
Date: 4 Jan 91 17:39:03 GMT
References: <OTTO.91Jan3125711@tukki.jyu.fi> <10251@hydra.Helsinki.FI> <OTTO.91Jan4115449@tukki.jyu.fi>
Sender: news@dirtydog.ima.isc.com (NEWS ADMIN)
Organization: Interactive Systems
Lines: 16