Topic: seekg - question


Author: hinnant@_anti-spam_metrowerks.com (Howard Hinnant)
Date: 1999/05/11
Raw View
In article <3732A432.F49DA579@mch.sni.de>, Bernhard Metzger
<Bernhard.Metzger@mch.sni.de> wrote:

> Does the basic_istream-member-function seekg alter
>    only the input sequence (A) or
>    both input and output sequence (B) ?
>
> Though (A) would be intuitive (at least to me) and some implementations
(MSVC++6.0 and RogueWave)
> implement (A) the ANSI/ISO-C++ Document seems to require (B):
>
>  basic_istream<charT,traits>& seekg(pos_type pos);
>
>   Effects:
>     If fail() != true, executes rdbuf()->pubseekpos(pos).
>   Returns:
>     *this.
>
> pubseekpos simply forwards the call to the virtual function seekpos.
> Since seekpos is called with only one Argument the 2nd arg
(which-argument) has the default
> value ios_base::in | ios_base::out. According to the description of
function seekpos
> for basic_stringbuf and basic_filebuf both input and output sequence are
altered
> for the above setting of the which-argument.
>
> Is this intended or just a "typo" in the ANSI/ISO-document and the above
citation should be
>
>    If fail() != true, executes rdbuf()->pubseekpos(pos,ios_base::in)    ?

This issue is before the C++ committee.  See:

http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-issues.html#136

-Howard
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Bernhard Metzger <Bernhard.Metzger@mch.sni.de>
Date: 1999/05/07
Raw View
Does the basic_istream-member-function seekg alter
   only the input sequence (A) or
   both input and output sequence (B) ?

Though (A) would be intuitive (at least to me) and some implementations (MSVC++6.0 and RogueWave)
implement (A) the ANSI/ISO-C++ Document seems to require (B):

 basic_istream<charT,traits>& seekg(pos_type pos);

  Effects:
    If fail() != true, executes rdbuf()->pubseekpos(pos).
  Returns:
    *this.

pubseekpos simply forwards the call to the virtual function seekpos.
Since seekpos is called with only one Argument the 2nd arg (which-argument) has the default
value ios_base::in | ios_base::out. According to the description of  function seekpos
for basic_stringbuf and basic_filebuf both input and output sequence are altered
for the above setting of the which-argument.

Is this intended or just a "typo" in the ANSI/ISO-document and the above citation should be

   If fail() != true, executes rdbuf()->pubseekpos(pos,ios_base::in)    ?
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html              ]