c++/10424: fstream open with ios_base::in|out|app always fails
SCampbell@Sequoianet.com
SCampbell@Sequoianet.com
Wed Apr 16 17:46:00 GMT 2003
>Number: 10424
>Category: c++
>Synopsis: fstream open with ios_base::in|out|app always fails
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Apr 16 17:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Steven M Campbell
>Release: gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
>Organization:
>Environment:
RedHat 8 and 9 and HPUX using gcc3.2 were tested
>Description:
This program always delivers the 'Open failed' message:
#include "iostream"
#include "fstream"
using namespace std;
int main(int argc, char **argv) {
fstream f;
int fd;
f.open("myfile",ios_base::in|ios_base::out|ios_base::app);
if (!f.is_open()) {
cerr << "Open Failed" << endl;
exit(255);
}
f.close();
return(0);
}
>How-To-Repeat:
Run the code in the Description section, it should behave like a C 'fopen("myfile","a+")', ie, it should use an existing file or create the file if it does not exist. Instead it always fails regardless of the presence of the test file (myfile).
>Fix:
None that I know of.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list