Image

Imagetimv wrote in Imagecpp

I have written a program that reads data from a file. The data looks like this:

begin points
1, 1, 0
-1, 1, 0
1, -1, 0
-1, -1, 0
end points

begin faces
1, 2, 3
2, 3, 4
end faces

I don't know if the algorithm I have written to read the data is good/efficient...particularly where I read a line of three numbers and parse it. Would any of you care to take a look at it and tell me if there is a more efficient/elegant way to write it. I am particularly interested in how I can switch from using readline() to a sort of buffered input using >>. What I have just seems like a lot of work!!

The code to parse the file can be found here: Object3.cpp beginning from the constructor "Object3::Object3(string filename)".