This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
- From: kawai at tkpe1 dot sumitomo-chem dot co dot jp
- To: gcc-gnats at gcc dot gnu dot org
- Date: 10 Feb 2003 20:06:07 -0000
- Subject: c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
- Reply-to: kawai at tkpe1 dot sumitomo-chem dot co dot jp
>Number: 9648
>Category: c++
>Synopsis: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Feb 10 20:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Takashi Kawai
>Release: gcc-3.2.2, --enable-shared
>Organization:
>Environment:
Redhat Linux 7.2J, Dell PE2450 (Pentium III 1GHz x 2)
>Description:
The file "$HOME/foo.bar" should be opened whether it exists or not. g++-2.95.3 works, however g++-3.22 doesn't work when the file doesn't exist; it says "cannot open /home/kawai/foo.bar"
>How-To-Repeat:
using namespace std;
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
int main(void)
{
string filename(getenv("HOME"));
filename += "/foo.bar";
std::fstream foo;
foo.open(filename.c_str(),ios::in | ios::out);
if (!foo) {
cerr << "Cannot open " << filename << endl;
} else {
cerr << "successfully opened " << filename << endl;
}
foo.close();
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: