C++文件操作之 seekg/seekp/tellg/tellp

问题描述:

C++文件操作之 tellg/tellp/seekg/seekp 的使用

问题解决:

(1)seekg/tellg/seekp/tellp 使用

clipboard

tellp用于ostream调用,用来“告知”流指针的位置,返回值为streampos

            tellg用于istream调用,用来“告知”流指针的位置,返回值为streampos

其中p表示“写指针”,g表示“读指针”。

inout

注:

        以上是对同一个文件流进行操作,注意其中的ostream out2(in2.rdbuf())  第32行(使用的是ostream)

源文件:

Seek.cpp

posted @ 2013-08-13 09:21  罗松超  阅读(1800)  评论(0编辑  收藏  举报