> Read the standard. XPG6 says: > > a+ or ab+ or a+b Append; open or create file for update, writing > at end-of-file. > > Opening a file with append mode (a as the first character in the > mode argument) shall cause all subsequent writes to the file to be > forced to the then current end-of-file, regardless of intervening > calls to fseek( ). > > ISO C99: > > a+ append; open or create text file for update, writing at > end-of-file > > Opening a file with append mode (theathe as the first character in > the mode argument) causes all subsequent writes to the file to be > forced to the then current end-of-file, regardless of intervening > calls to the fseek function. In some implementations, opening a > binary file with append mode (thebthe as the second or third > character in the above list of mode argument values) may initially > position the file position indicator for the stream beyond the > last data written, because of null character padding. > > When a file is opened with update mode (the+the as the second or > third character in the above list of mode argument values), both > input and output may be performed on the associated > stream. However, output shall not be directly followed by input > without an intervening call to the fflush function or to a file > positioning function (fseek, fsetpos,orrewind), and input shall > not be directly followed by output without an intervening call to > a file positioning function, unless the input operation encounters > end-of- file. Opening (or creating) a text file with update mode > may instead open (or create) a binary stream in some > implementations. > > I guess you argue "opening a file with fopen in mode a+ will move file > position indicator in a stream at the end", but it's not true. > Sorry. In previos versions of libc6 the file position indicator was at the end, and I thougth it was a bug. -- Ander Lozano Pérez ander1@wanadoo.es http://perso.wanadoo.es/ander1 - http://diasce.es.gnome.org
Attachment:
signature.asc
Description: Esta parte del mensaje esta firmada digitalmente