std::basic_streambuf<CharT,Traits>::pubseekoff, std::basic_streambuf<CharT,Traits>::seekoff
来自 cppreference.cn
< cpp | io | basic streambuf
pos_type pubseekoff( off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = ios_base::in | ios_base::out ); |
(1) | |
protected: virtual pos_type seekoff( off_type off, std::ios_base::seekdir dir, |
(2) | |
设置输入和/或输出序列的位置指示器到相对于某个其他位置的位置。
1) 调用最派生类的 seekoff(off, dir, which)。
2) 此函数的基类版本无效果。派生类可以重写此函数以允许对位置指示器进行相对定位。
目录 |
[编辑] 参数
off | - | - 用于设置位置指示器的相对位置。 | ||||||||
dir | - | 定义应用相对偏移量的基本位置。它可以是以下常量之一
| ||||||||
which | - | - 定义影响输入及/或输出序列的哪个。它可以是下列常量之一或组合
|
[编辑] 注意
并非所有参数组合都有效,详情请参阅 seekoff
的派生版本。
[编辑] 返回值
1) seekoff(off, dir, which) 的返回值
2) 由位置指示器定义的最终绝对位置。基类版本返回 pos_type(off_type(-1))。
[编辑] 示例
本节不完整 原因:无示例 |
[编辑] 缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
缺陷报告 | 应用于 | 发布时的行为 | 正确的行为 |
---|---|---|---|
LWG 55 | C++98 | seekoff 的基类版本曾返回一个未定义的无效流位置 |
返回 pos_type(off_type(-1)) |
[编辑] 参阅
调用 seekpos() (公开成员函数) | |
[虚] |
使用相对地址重新定位文件位置 ( std::basic_filebuf<CharT,Traits> 的虚保护成员函数) |
[虚] |
使用相对寻址重新定位输入序列、输出序列或两者的下一个指针 ( std::basic_stringbuf<CharT,Traits,Allocator> 的虚保护成员函数) |
[虚] |
使用相对寻址重新定位输入序列、输出序列或两者的下一个指针 ( std::strstreambuf 的虚保护成员函数) |