[ostream.seeks] # 31 Input/output library [[input.output]](./#input.output) ## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#ostream.seeks) ### 31.7.6 Output streams [[output.streams]](output.streams#ostream.seeks) #### 31.7.6.2 Class template basic_ostream [[ostream]](ostream#seeks) #### 31.7.6.2.5 Seek members [ostream.seeks] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6287) Each seek member function begins execution by constructing an object of class sentry[.](#1.sentence-1) It returns by destroying the sentry object[.](#1.sentence-2) [🔗](#lib:tellp,basic_ostream) `pos_type tellp(); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6297) *Returns*: Iffail() != false, returnspos_type(-1) to indicate failure[.](#2.sentence-1) Otherwise, returnsrdbuf()->​pubseekoff(​0, cur, out)[.](#2.sentence-2) [🔗](#lib:seekp,basic_ostream) `basic_ostream& seekp(pos_type pos); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6314) *Effects*: Iffail() != true, executesrdbuf()->pubseekpos(pos, ios_base​::​out)[.](#3.sentence-1) In case of failure, the function callssetstate(failbit) (which may throwios_base​::​failure)[.](#3.sentence-2) [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6325) *Returns*: *this[.](#4.sentence-1) [🔗](#lib:seekp,basic_ostream_) `basic_ostream& seekp(off_type off, ios_base::seekdir dir); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6336) *Effects*: Iffail() != true, executesrdbuf()->pubseekoff(off, dir, ios_base​::​out)[.](#5.sentence-1) In case of failure, the function calls setstate(failbit) (which may throw ios_base​::​failure)[.](#5.sentence-2) [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L6345) *Returns*: *this[.](#6.sentence-1)