Polygonal String Processing
I''m using C++ to do some data reading from a standard ASCII text file. Here is an example text file:
-------------------------------
3 100,200 300,400 500,600
4 111,222 111,333 111,444 111,555
2 222,111 333,888
-------------------------------
Notice how the first number of each row tells you how many pairs of numbers follow it.
Here is my problem, I can''t think up of a quick way to extract these pairs of numbers. Normally I use sscanf to read the values, but with sscanf you have to know exactly how many values to read in. Does anyone know of a way to read in the first number and then use some sort of loop the read in the pairs of numbers?
You probably can tell that I''m new to this.
In case you are wondering those numbers correspond to number of polygon vertices, followed by their vertex number and texture vertex number.
|

http://druidgames.cjb.net/
That looks simple. Thanks.
So fscanf doesn''t automatically read the next line everytime it is executed.
One more question what does "%d%*c%d" mean. I know %d is the integer, but what is "%*c"?
So fscanf doesn''t automatically read the next line everytime it is executed.
One more question what does "%d%*c%d" mean. I know %d is the integer, but what is "%*c"?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement