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<> ?
I was just wondering why the member functions tellg() defined in basic_istream<> class and
Share
And how would you distinguish them in bidirectional streams,
like
std::fstreamorstd::stringstream? Streams are allowedto maintain separate pointers for input and output:
fstreamdoesn’t, but
stringstreamdoes. So you need either a flag toindicate which one you want (as is the case in
streambuf), oryou need two separate functions.