Topic: Should basic_istream::seekg() reset the failure bits?
Author: pedwards@dmapub.dma.org (Phil Edwards)
Date: Mon, 29 Jan 2001 18:34:04 GMT Raw View
I've been handed this problem:
iostream::seekg does not clear the fail and eof bits
when accessing a good position after a bad one.
ie : if you seekg(0) after reaching the EOF, fail() and
eof() remains true.
The relevent sections ([27.6.1.3], [27.5.2.4.2]) don't seem to speak to
this point. (I'm probably looking in the wrong sections...)
Should seekg be clearing these bits? I don't think so, but figured I'd
better ask.
Thanks for your time,
Phil
--
pedwards at disaster dot jaj dot com | pme at sources dot redhat dot com
devphil at several other less interesting addresses in various dot domains
The gods do not protect fools. Fools are protected by more capable fools.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: kuehl@ramsen.informatik.uni-konstanz.de (Dietmar Kuehl)
Date: Tue, 30 Jan 2001 12:14:43 GMT Raw View
Hi,
Phil Edwards (pedwards@dmapub.dma.org) wrote:
: Should seekg be clearing these bits?
My copy of the standard is pretty clear on what 'seekg()' is supposed
to do: "Effects: If fail() != true, executes rdbuf()->pubseekpos(pos)."
(27.6.1.3, the paragraph describing 'seekg()'). Also, it is put under
the section "unformatted input functions" and as such it starts out by
constructing a 'sentry' object and performs it's operation only if this
one yields 'true'. I can't see why 'seekg()' would reset any state
flags! In fact, it is supposed to be noop if the failbit or the badbit
is set...
--
<mailto:dietmar_kuehl@yahoo.com> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]
Author: pedwards@dmapub.dma.org (Phil Edwards)
Date: Tue, 30 Jan 2001 14:33:45 GMT Raw View
Dietmar Kuehl <dietmar_kuehl@yahoo.com> wrote:
>
> I can't see why 'seekg()' would reset any state flags!
Great, because I couldn't either. :-)
Thanks!
Phil
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
[ Note that the FAQ URL has changed! Please update your bookmarks. ]