I was just wondering why the member functions tellg()
defined in basic_istream<>
class and tellp()
defined in basic_ostream<>
class have different names. Is that because basic_fstream<>
is derived from basic_istream<>
and basic_ostream<>
?
And how would you distinguish them in bidirectional streams,
like std::fstream
or std::stringstream
? Streams are allowed
to maintain separate pointers for input and output: fstream
doesn't, but stringstream
does. So you need either a flag to
indicate which one you want (as is the case in streambuf
), or
you need two separate functions.