Re: Help - I'm at wit's end...

From: Ben Pfaff (blp_at_cs.stanford.edu)
Date: 12/30/04


Date: Wed, 29 Dec 2004 15:47:27 -0800

BRG <brg@nowhere.org> writes:

> Interesting - I was not aware that a 't' option existed - is this an
> ANSI designated file opening mode?

There is no `t' option--at least, not portably. No one
interested in writing portable code would use `t', because it
invokes undefined behavior. Here is the complete list from the
C99 standard, section 7.19.5.3 paragraph 3:

3 The argument mode points to a string. If the string is one of
     the following, the file is open in the indicated
     mode. Otherwise, the behavior is undefined.228)

     r open text file for reading
     w truncate to zero length or create text
                       file for writing
     a append; open or create text file for
                       writing at end-of-file
     rb open binary file for reading
     wb truncate to zero length or create binary
                       file for writing
     ab append; open or create binary file for
                       writing at end-of-file
     r+ open text file for update (reading and
                       writing)
     w+ truncate to zero length or create text
                       file for update
     a+ append; open or create text file for
                       update, writing at end-of-file
     r+b or rb+ open binary file for update (reading and
                       writing)
     w+b or wb+ truncate to zero length or create binary
                       file for update
     a+b or ab+ append; open or create binary file for
                       update, writing at end-of-file

-- 
Ben Pfaff 
email: blp@cs.stanford.edu
web: http://benpfaff.org