I'm making a parser for .obj files . I'm using scanf but I'm getting really strange results.
void loader::readIn()
{
//!takes in the all the data and
//!puts in string first.
std::string myString; //!save string
float tmpX,tmpY,tmpZ; //!storing the floats in here .
while(!myFile.eof())
{
std::getline(myFile,myString); //!intake string
if(myString[0] == 'v' && myString[1] == ' ') //!check value
{
scanf_s(myString.c_str(), "v %f %f %f" ,&tmpX,&tmpY,&tmpZ);
std::cout<< tmpX <<" "<< tmpY <<" "<<tmpZ <<std::endl;
}
}
}
This is my code.
Below this is what i am trying to read in
v 0.0 0.0 0.0
v 0.0 0.0 1.0
v 0.0 1.0 0.0
v 0.0 1.0 1.0
v 1.0 0.0 0.0
v 1.0 0.0 1.0
v 1.0 1.0 0.0
v 1.0 1.0 1.0
And this is the result when I cout the answers.
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
-1.07374e+008 -1.07374e+008 -1.07374e+008
Grateful for any help.