basic_ostream& seekp( pos_type pos );
(1) (2)Sets the output position indicator of the current associated streambuf
object.
Behaves as UnformattedOutputFunction (except without actually performing output). After constructing and checking the sentry object,
(since C++11) 1)if
fail() != true, sets the output position indicator to absolute (relative to the beginning of the file) value
posby calling
rdbuf()->pubseekpos(pos, std::ios_base::out). In case of failure, calls
setstate(std::ios_base::failbit).
2)if
fail() != true, sets the output position indicator to offset
offrelative to
dirby calling
rdbuf()->pubseekoff(off, dir, std::ios_base::out). In case of failure, calls
setstate(std::ios_base::failbit).
[edit] Parameters pos - absolute position to set the output position indicator to off - relative position (positive or negative) to set the output position indicator to dir - defines base position to apply the relative offset to. It can be one of the following constants: Constant Explanation beg the beginning of a stream end the ending of a stream cur the current position of stream position indicator [edit] Return value*this
[edit] Exceptions [edit] Example [edit] Defect reportsThe following behavior-changing defect reports were applied retroactively to previously published C++ standards.
DR Applied to Behavior as published Correct behavior LWG 129 C++98 there was no way to indicate a failure setsfailbit
on failure LWG 136 C++98 seekp
could set the input stream only sets the output stream LWG 537 C++98 1. the type of pos was pos_type&
off_type&
1. corrected to pos_type
off_type
LWG 2341 C++98 the resolution of LWG issue 129 for overload (2) was removed restored [edit] See also returns the output position indicator
std::basic_istream<CharT,Traits>
) [edit] sets the input position indicator
std::basic_istream<CharT,Traits>
) [edit]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4