std::basic_streambuf<CharT,Traits>::pubseekpos, std::basic_streambuf<CharT,Traits>::seekpos
来自 cppreference.cn
< cpp | io | basic streambuf
pos_type pubseekpos( pos_type pos, std::ios_base::openmode which = std::ios_base::in | std::ios_base::out ); |
(1) | |
protected: virtual pos_type seekpos( pos_type pos, |
(2) | |
将输入和/或输出序列的位置指示器设置为绝对位置。
1) 调用最派生类的 seekpos(pos, which)。
2) 此函数的基类版本无效。派生类可以重写此函数以允许位置指示器的绝对定位。
目录 |
[编辑] 参数
pos | - | 要将位置指示器设置到的绝对位置 | ||||||
which | - | 定义要影响的输入和/或输出序列。它可以是以下常量之一或组合
|
[编辑] 返回值
1) seekpos(pos, which) 的返回值。
2) 由位置指示器定义的最终绝对位置。基类版本返回 pos_type(off_type(-1))。
[编辑] 示例
本节不完整 原因:没有示例 |
[编辑] 缺陷报告
以下行为变更缺陷报告被追溯应用于先前发布的 C++ 标准。
DR | 应用于 | 已发布行为 | 正确行为 |
---|---|---|---|
LWG 55 | C++98 | seekpos 的基类版本返回未定义的无效流位置 |
返回 pos_type(off_type(-1)) |
[编辑] 参见
调用 seekoff() (公共成员函数) | |
[虚函数] |
使用绝对寻址重新定位文件位置 (std::basic_filebuf<CharT,Traits> 的虚函数保护成员函数) |
[虚函数] |
使用绝对寻址重新定位输入序列、输出序列或两者的下一个指针 (std::basic_stringbuf<CharT,Traits,Allocator> 的虚函数保护成员函数) |
[虚函数] |
使用绝对寻址重新定位输入序列、输出序列或两者的下一个指针 (std::strstreambuf 的虚函数保护成员函数) |