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++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 55 | C++98 | seekoff 的基类版本返回未定义的无效流位置 |
返回 pos_type(off_type(-1)) |
[编辑] 参见
调用 seekpos() (公共成员函数) | |
[虚拟] |
使用相对寻址重新定位文件位置 (`std::basic_filebuf<CharT,Traits>` 的虚拟受保护成员函数) |
[虚拟] |
使用相对寻址重新定位输入序列、输出序列或两者的下一个指针 (`std::basic_stringbuf<CharT,Traits,Allocator>` 的虚拟受保护成员函数) |
[虚拟] |
使用相对寻址重新定位输入序列、输出序列或两者的下一个指针 (`std::strstreambuf` 的虚拟受保护成员函数) |