This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: istream bug
- To: Robert Schweikert <rjschwei at mindspring dot com>
- Subject: Re: istream bug
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 04 Jan 2001 17:28:19 -0200
- Cc: gcc at gcc dot gnu dot org
- Organization: GCC Team, Red Hat
- References: <3A53E7C1.83E19333@mindspring.com>
On Jan 4, 2001, Robert Schweikert <rjschwei@mindspring.com> wrote:
> When using the "ios::nocreate" opening mode on an istream the file
> pointer moves to the end of the file which causes the read with the
> stream operator ">>" to fail.
Wouldn't it be the case that you failed to specify that the stream is
for input? By passing ios::nocreate, you overrode the default
argument that is ios::input (sp?), so you should have ORed
ios::nocreate to ios::input to get an input stream. Yes, it's
counter-intuitive, but that's the way it is implemented.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me