初めてseekgを使おうとしています。ドキュメントでは、引数は次のようになります。
istream& シーク ( streampos pos );
istream& seekg ( streamoff off, ios_base::seekdir dir );
From what I understood, 'streampos pos' could be an int? I saw examples like "seekg(0)" However when try to compile this it says I'm using invalid arguments:
void function(int pos){
ifstream reader("data.dat");
if(!reader.is_open())
return 0;
int posinArchive = pos * 74;
reader.seekg(posinArchive);
I even tried to cast it to streampos directly:
void function(int pos){
ifstream reader("data.dat");
if(!reader.is_open())
return 0;
int posinArchive = pos * 74;
reader.seekg((streampos)posinArchive);
same thing. seekg(0), nothing too. What's wrong?