The GNU C++ Iostream Library - Output Position

Node: Output Position Next: Ostream Housekeeping Prev: Writing Up: Ostream

Repositioning an ostream

You can control the output position (on output streams that actually support positions, typically files) with these methods:

Method streampos ostream::tellp ()
Return the current write position in the stream.

Method ostream& ostream::seekp (streampos loc)
Reset the output position to loc (which is usually the result of a previous call to ostream::tellp ). loc specifies an absolute position in the output stream.

Method ostream& ostream::seekp (streamoff loc, rel)
Reset the output position to loc, relative to the beginning, end, or current output position in the stream, as indicated by rel (a value from the enumeration ios::seekdir ):

beg
Interpret loc as an absolute offset from the beginning of the file.

cur
Interpret loc as an offset relative to the current output position.

end
Interpret loc as an offset from the current end of the output stream.


Next: Ostream Housekeeping Up: Ostream