读书人

急求!c++中读取文本文件读取完后想

发布时间: 2012-03-26 15:46:55 作者: rapoo

急求!c++中读取文本文件,读取完后想把光标返回开头再读一次,怎么做啊???
大神们,谢谢了
请别说用,seektobegin()和rewind()
for(string s ; getline(in,s) ;len++ ) ;

if(in.eof())
{
cout<<"读文件结束"<<endl ;
//rewind(in) ;
}

我的想法是把读文件的指针在次回到文件的开始位置
谢谢

[解决办法]
in是个什么类型的?
[解决办法]
http://www.cplusplus.com/reference/iostream/istream/seekg/


istream& seekg ( streampos pos ); istream& seekg ( streamoff off, ios_base
:seekdir dir );


valueoffset is relative to...
ios_base::begbeginning of the stream buffer
ios_base::curcurrent position in the stream buffer
ios_base::endend of the stream buffer

这些东西自己查查 自己动手 丰衣足食

读书人网 >C++

热点推荐