Hi,
I'm trying to create a 3d model loader, so one part requires me count the number of '/' in a line and store it. After that I need to go back to the start of the line so I can get the data.
Here is what I'm trying to do. It seems to work for about 20-30 lines and then corrupts the file. Can anyone see why this approach might cause an error ? or have a better way of doing what I'm trying to do ?
Thanks!Code:int numVerts = 0,u = 0; char c; while((c = infile.get()) != '\n'){ if(c == '/') ++numVerts; ++u; }numVerts /= 2; for(; u >= 0; --u){ infile.unget(); }



LinkBack URL
About LinkBacks


