What is the differnce b/w seekg() and seekp()?

Nov 15, 2018 at 1:22pm
What is the difference b/w seekg() and seekp()? Similarly what is the difference between tellg() and tellp()? Does they depend upon how I open my file in reading or writing mode?
Nov 15, 2018 at 1:54pm
The g functions track the get (read) position.

The p functions track the put (write) position.

Clearly they can be different.
Nov 15, 2018 at 6:28pm
it may be a little confusing because they cannot be different on file streams (because C++ file streams are built on top of C file streams, and C file streams have only one position)

std::stringstream is where their difference can be most readily demonstrated.
Topic archived. No new replies allowed.