Reading is easy: you are already doing that.
And writing is easy: you are doing that as well.
All you need to is Seek the position:
istream::seekg - C++ Reference[
^]
It's worth noting that if you are switching from Read to Write or vice versa, it's a good idea to seek the right position anyway, as some systems do maintain independent input and output pointers.