This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: istream bug


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]