seekg

hi, i have this code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
data.open("Data.dat");
data.seekg(0,ios::beg);
while(!data.eof()){
                   data>>nick;
                   acc.open(nick.c_str());
                   acc.seekg(0,ios::beg);
                   acc>>str; acc>>helper; acc>>helper;
                   cout<<"Level: "<<helper<<",  ";
                   acc>>itmid[1]; acc>>itmid[2]; acc>>itmid[3]; acc>>itmid[4]; acc>>itmid[5]; acc>>itmid[6];
                   acc.close();
                   helper=ZRATAJ_GS(itmid);
                   cout<<"GL: "<<helper;
                   }
data.close();



first time the program gets to this part of code, it will go to the beginning of the file (data.dat), but when the program gets to this part second, third,.....nth time it didn`t go to the beginning of th file (data.dat).
Can I ask why?? :) (ZRATAJ_GS is int function and it has no problem)
thanks for answers and sorry for double post in the last one I write ot badly D:
Last edited on
If your code isn't too long I'd like you to post at least the main(...) body. How do you know it's not reading the file? It could be another issue entirely.
lol, xD

when you wrote that you want know that how I know that it isn`t reading I create this part of code as a function, and now it is everytime reading from beginning lol.

this function is showing a chart with all players in my game. Nicks of all player are wrote in data.dat, and before I do it as a function, it was part of int main, first time when I press '8' in menu (its button what will show this chart ingame) it shows this chart, but second,third.... time it didn`t show.
Now when i create it as a function it`s OK....

but thx, if you didn`t answer me, I didn`t do it as a function, and it would be still unfunctionable :D

(Sorry for bad EN);
Topic archived. No new replies allowed.