From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23969 invoked by alias); 9 Apr 2002 06:07:49 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 23910 invoked by uid 61); 9 Apr 2002 06:07:41 -0000 Date: Mon, 08 Apr 2002 23:07:00 -0000 Message-ID: <20020409060741.23909.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kingleo@gmx.at, paolo@gcc.gnu.org From: bkoz@gcc.gnu.org Reply-To: bkoz@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, kingleo@gmx.at, paolo@gcc.gnu.org, gcc-gnats@gcc.gnu.org Subject: Re: libstdc++/5180: seekp() on fstreams opened in read only mode X-SW-Source: 2002-04/txt/msg00515.txt.bz2 List-Id: Synopsis: seekp() on fstreams opened in read only mode State-Changed-From-To: feedback->closed State-Changed-By: bkoz State-Changed-When: Mon Apr 8 23:07:37 2002 State-Changed-Why: The infinte loop is user error, I'm afraid. A better way to write that loop would be: while (in.good()) { string s; getline(in, s); cout << s << endl;; } Anyway. This bug report actually crosses the paths of two library bugs, so this is perhaps why you might see differing interpretations of this code with other compilers and toolchains. To wit: fstream in(name, std::ios::in); in.seekp(0); state = in.rdstate(); will give different results. I think state should be failbit, and here's why: basic_ostream::seekp(pos_type __pos) // DR 136 this->rdbuf()->pubseekpos(__pos, ios_base::out); then filebuf::seekpos // DR 171 best, benjamin http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5180