命名空间
变体
操作

std::basic_spanbuf<CharT,Traits>::seekpos

来自 cppreference.cn
< cpp‎ | io‎ | basic spanbuf
protected:

pos_type seekpos( pos_type sp, std::ios_base::openmode which =

                      std::ios_base::in | std::ios_base::out ) override;
(since C++23)

如果可能,将下一个指针重定位到 get 和/或 put 区域,到 sp 指示的位置。

等价于 return seekoff(off_type(sp), std::ios_base::beg, which);

目录

[编辑] 参数

sp - 流位置,例如通过 seekoff()seekpos() 获得的位置
which - 定义是否影响输入序列、输出序列或两者。它可以是以下常量之一或组合
常量 解释
in 影响输入序列
out 影响输出序列

[编辑] 返回值

成功时返回 sp,失败时返回 pos_type(off_type(-1))

[编辑] 注解

seekpos()std::basic_streambuf::pubseekpos() 调用,而 std::basic_streambuf::pubseekpos() 又由 std::basic_istream::seekg()std::basic_ostream::seekp() 的单参数版本调用。

[编辑] 示例

[编辑] 参见

调用 seekpos()
(std::basic_streambuf<CharT,Traits> 的公有成员函数) [编辑]
[virtual]
使用绝对寻址重定位输入序列、输出序列或两者中的下一个指针
(std::basic_stringbuf<CharT,Traits,Allocator> 的虚保护成员函数) [编辑]
[virtual]
使用绝对寻址重定位输入序列、输出序列或两者中的下一个指针
(std::strstreambuf 的虚保护成员函数) [编辑]