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

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?
The g functions track the get (read) position.

The p functions track the put (write) position.

Clearly they can be different.
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.