libstdc++/4627: ios::ate open does not seek to EOF, it truncates

rodrigc@gcc.gnu.org rodrigc@gcc.gnu.org
Sat Oct 20 19:54:00 GMT 2001


Synopsis: ios::ate open does not seek to EOF, it truncates

State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Sat Oct 20 19:54:02 2001
State-Changed-Why:
    Look at page 659 of the ISO C++ standard.
    If you open an ofstream for writing, if you
    do not specify ios::app, then it
    will be equivalent to opening the file
    with fopen() with the "w" mode.  This will
    truncate the file before writing to it.
    
    So, if you want to open an ofstream for writing,
    add ios::app to the mode if you want to append to it.
    
    Not a gcc bug.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=4627&database=gcc



More information about the Gcc-prs mailing list