Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!harvard!husc6!talcott!panda!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!burdvax!psuvax1!psuvm.bitnet!ukma!ukecc!edward From: edward@ukecc.UUCP (Edward C. Bennett) Newsgroups: net.unix-wizards Subject: Re: a question on open() and lseek() Message-ID: <423@ukecc.UUCP> Date: Sat, 26-Apr-86 17:54:09 EDT Article-I.D.: ukecc.423 Posted: Sat Apr 26 17:54:09 1986 Date-Received: Fri, 2-May-86 21:05:59 EDT References: <2594@brl-smoke.ARPA> <691@edison.UUCP> <1968@ism780c.UUCP> Organization: Univ. of Ky. Engineering Computing Center Lines: 32 Keywords: ifdef In article <1968@ism780c.UUCP>, tim@ism780c.UUCP (Tim Smith) writes: > In article <691@edison.UUCP> jso@edison.UUCP (John Owens) writes: > >> Is there any reason to use the sequence: > >> f = open( file, O_WRONLY ); > >> lseek( f, 0, L_XTND ); > >> instead of the single call: > >> f = open( file, O_WRONLY | O_APPEND ); > > > >Because many versions of UNIX do not support the O_APPEND flag; it's > >a fairly recent innovation. All versions since v7 (at least that I'm > >aware of) should support the open/lseek method. > > How about doing both? Unixes that do not recognize O_APPEND will probably > ignore it, and unixes that do will ignore the lseek. > #ifdef O_APPEND f = open( file, O_WRONLY | O_APPEND ); #else f = open( file, O_WRONLY ); lseek( f, 0, L_XTND ); #endif -- Edward C. Bennett UUCP: ihnp4!cbosgd!ukma!ukecc!edward Kentucky: The state that is being dragged, kicking and screaming, into the 20th century. "Goodnight M.A."