public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
@ 2003-02-10 20:26 Takashi Kawai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Kawai @ 2003-02-10 20:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/9648; it has been noted by GNATS.
From: Takashi Kawai <kawai@tkpe1.sumitomo-chem.co.jp>
To: gcc-gnats@gcc.gnu.org
Cc: kawai@tkpe1.sumitomo-chem.co.jp (Takashi Kawai)
Subject: Re: c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
Date: Tue, 11 Feb 2003 05:23:15 +0900 (JST)
February 11, 2003
I'm sorry. The code is wrong and g++-3.22 is exactly correct.
If the line:
> foo.open(filename.c_str(),ios::in | ios::out);
is replaced to:
> foo.open(filename.c_str(),ios::in | ios::out | ios::trunc)
, then it works.
I'd completely misunderstood that "ios::in | ios::out" works even
if the file doesn't exist; in fact, it doesn't work only when the file
exists.
I'm very sorry to bother you about my mistake.
Best wishes,
Takashi Kawai
Takatsuki / Japan
> Thank you very much for your problem report.
> It has the internal identification `c++/9648'.
> The individual assigned to look at your
> report is: unassigned.
>
> >Category: c++
> >Responsible: unassigned
> >Synopsis: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
> >Arrival-Date: Mon Feb 10 20:16:00 UTC 2003
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does)
@ 2003-02-10 20:16 kawai
0 siblings, 0 replies; 2+ messages in thread
From: kawai @ 2003-02-10 20:16 UTC (permalink / raw)
To: gcc-gnats
>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:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-10 20:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-10 20:26 c++/9648: g++-3.2.2 cannot create a new file. (g++-2.95.3 does) Takashi Kawai
-- strict thread matches above, loose matches on Subject: below --
2003-02-10 20:16 kawai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).