Reputation: 25
I have written a function that reads an obj. file and converts the strings into floats. The code worked fine untill the stof() function stops working properly. I'm not sure how this part suddenly stops working since it seems such a straight-forward thing to do and it has worked everytime untill now.
ftemp = std::stof(stemp);
ftemp and stemp (storage for float and string) are declared at the beginning of my function and are overwritten for each number. I use fstream and iterators to find the numbers. The rest of the code is easy to imagine and works as expected so I'll ommit everything but the failing part.
this is in the .obj file and should represent a textured plane.
# Blender v2.68 (sub 0) OBJ File: ''
# www.blender.org
v -1.000000 1.000000 -1.000000
v 1.000000 1.000000 -1.000000
v -1.000000 1.000000 1.000000
v 1.000000 1.000000 1.000000
vt 0.000100 0.000100
vt 0.999900 0.000100
vt 0.000100 0.999900
vt 0.999900 0.999900
s off
f 2/1 1/2 4/3
f 1/2 3/4 4/3
It fails at the point it reads the vt lines. So when stemp holds "0.000100" ftemp should hold 0.000100 yet it holds: 9.9999997e-005. The rest works the same way and does it correctly.
Any help would be greatly appreciated.
Upvotes: 0
Views: 485