[Bug c++/11436] New: ios::app bug on RedHat 7.3 with gcc 3.3

p_hodigere at yahoo dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 4 20:21:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11436

           Summary: ios::app bug on RedHat 7.3 with gcc 3.3
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: p_hodigere at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org

Using ios::app to open a file fails on RH 7.3 when compiled with gcc 3.3. The 
same application can open the file in append mode when compiled with gcc 2.96.

Attached is the test aplication.

All the following combinations of open mode's fail:
fp.open("some file", ios::app);
fp.open("some file", ios::in | ios::app);
fp.open("some file", ios::in | ios::out | ios::app);

In order to open the file in append mode, both ios::out and ios::app need to 
be used:
fp.open("some file", ios::out | ios::app);

Find below a test application to reproduce this bug.

-Pradeep

#include <iostream.h>
#include <fstream.h>

int main() {

fstream fp;

    fp.open("test.txt", ios::app);

    if (fp.is_open() ) {
        fp << "test\n";
        fp.close();
    }
    else
        cout << "Unable to open file";

    return 0;
}



More information about the Gcc-bugs mailing list