Xref: utzoo comp.os.msdos.programmer:2654 comp.lang.c:35024 Path: 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: <10251@hydra.Helsinki.FI> Sender: news@dirtydog.ima.isc.com (NEWS ADMIN) Organization: Interactive Systems Lines: 16 In 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