public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: paolo@gcc.gnu.org To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kingleo@gmx.at, nobody@gcc.gnu.org, paolo@gcc.gnu.org Subject: Re: libstdc++/5180: seekp() on fstreams opened in read only mode Date: Mon, 24 Dec 2001 01:45:00 -0000 [thread overview] Message-ID: <20011224094556.29373.qmail@sources.redhat.com> (raw) Synopsis: seekp() on fstreams opened in read only mode Responsible-Changed-From-To: unassigned->paolo Responsible-Changed-By: paolo Responsible-Changed-When: Mon Dec 24 01:45:56 2001 Responsible-Changed-Why: Taking care of it. State-Changed-From-To: open->feedback State-Changed-By: paolo State-Changed-When: Mon Dec 24 01:45:56 2001 State-Changed-Why: I think the behaviour you are reporting is standard conforming. In fact, after seekp(0) the failbit is set and the standard prescribes that all IOStreams operations have no effect once the stream state indicates an error situation. Compare the behaviour of the testcase with that (identical) of: #include <iostream> #include <fstream> #include <string> using namespace std; int main( int argc, char** argv ) { if( argc != 2) return 1; fstream in( argv[1], std::ios::in ); if( !in ) { cout << "cannot open file " << endl; return 2; } /* in.seekp(0); // <<<<<<< if (in.rdstate() & ios::failbit) { cout << "fail" << endl; in.clear(); } */ while( !in.eof() ) { string s; //getline( in, s ); cout << s << endl;; } return 0; }; http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5180
next reply other threads:[~2001-12-24 9:45 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-12-24 1:45 paolo [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-04-08 23:07 bkoz 2001-12-23 8:36 kingleo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20011224094556.29373.qmail@sources.redhat.com \ --to=paolo@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ --cc=gcc-gnats@gcc.gnu.org \ --cc=gcc-prs@gcc.gnu.org \ --cc=kingleo@gmx.at \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).