Home > Back-end >  Could you tell me why ifstream read a file, a pointer does not move backward
Could you tell me why ifstream read a file, a pointer does not move backward

Time:12-15

Error code is as follows, if part of parentheses here is meaningless, replace with 1, sym for char, fin as an ifstream class, are global variables,
Bool isIdenfer ()
{
Char TOKEN [120].
If (1)
{
int i=0;
TOKEN [0]=sym;
Fin. Get (sym);
While (sym!=' ')
{
TOKEN [i++]=sym;
Fin. Get (sym);
}
TOKEN [+ + I]='\ 0';
Fout & lt; <"IDENFER" & lt; Fin. Seekg (1, ios_base: : cur);
return true;
}
return false;
}
Suggested I write errors, run the debug, found that because fin. The get function repeatedly read the first letter of the file, the loop can't jump out of bounds, can you tell me why
  • Related