C++ seekg()函数

seekg()是对输入流的操作 g是get缩写
seekp()是对输出流的操作 p是put缩写

seekg()
Moves the read position in a stream.//移动在流中读的位置
------------------------------------------------------------------------
basic_istream<Elem, Tr>& seekg(  //一个参数
    pos_type pos
);
basic_istream<Elem, Tr>& seekg(
    off_type off,                                     //两个参数
    ios_base::seekdir way
);
------------------------------------------------------------------------
参数
pos 
The absolute position in which to move the read pointer.
//移动读取指针的绝对位置

off //偏移量
An offset to move the read pointer relative to way.

way //  基地址
One of the ios_base::seekdir enumerations.
它有三个取值
ios::beg:表示输入流的开始位置
ios::cur:表示输入流的当前位置
ios::end:表示输入流的结束位置


在这里插入图片描述
输出结果:
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值