Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ki4pv.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!vax135!petsd!peora!ucf-cs!ki4pv!tanner From: tanner@ki4pv.UUCP (Tanner Andrews) Newsgroups: net.unix-wizards Subject: Re: how safe is it to read/write with fopen'ed files? Message-ID: <444@ki4pv.UUCP> Date: Wed, 28-Aug-85 12:17:20 EDT Article-I.D.: ki4pv.444 Posted: Wed Aug 28 12:17:20 1985 Date-Received: Sat, 31-Aug-85 08:34:16 EDT References: <4983@allegra.UUCP> Organization: CompuData South, DeLand Lines: 17 ] note referenced asks how safe it is to use read(2) with files ] opened using fopen(3) If you do not extract the file descriptor from the fp structure returned by fopen(2), many systems won't like it. The pointer value from fopen(3) is not likely to make a good fd. If you do extract the fd, chances are reasonably good that it will work. Of course, you must either (a) not be buffering your i/o, or (b) flush your buffers before you use read(2)/write(2). As good form you do well not to intermix section 2 i/o calls and section 3 i/o calls on the same file. Consider using open(2). -- Tanner Andrews, KI4PV uucp: ...!decvax!ucf-cs!ki4pv!tanner