Im reading a double from an excel is returning an int?

Back to topics list To post a new topic, please log in or register
avatar
83
BeLikeWater 2015.05.08 20:24
 

Hello there, Im having a bit of trouble here:


double Read_File(int i)
   {
      int handle=FileOpen(Archivo_Historical(),FILE_READ|FILE_CSV);
      while(Time[i]!=FileReadString(handle) && !FileIsEnding(handle))
         FileReadString(handle);
      int valor=StrToDouble(FileReadString(handle));
      FileClose(handle);
      return valor;

   }


Im reading values like 52.2,  90.3, etc....  but Im receiving them like 52.0 and 90.0 My excel uses "." and not "," as a decimal point. Maybe this is a clue of what could be happening.


Could you help me?


Thank you.


avatar
736
honest_knave 2015.05.08 22:55 #
 
double Read_File(int i)
   {
      int handle=FileOpen(Archivo_Historical(),FILE_READ|FILE_CSV);
      while(Time[i]!=FileReadString(handle) && !FileIsEnding(handle))
         FileReadString(handle);
//      int valor=StrToDouble(FileReadString(handle));
      double valor=StrToDouble(FileReadString(handle));
      FileClose(handle);
      return valor;

  }

 

avatar
83
BeLikeWater 2015.05.09 14:10 #
 

Oh my...

I think Im more retarded everyday.

Thank you soo much for pointing the error!



avatar
736
honest_knave 2015.05.09 14:27 #
 
Don't worry, I think we've all done that at some point! Or something similar.
Back to topics list  

To add comments, please log in or register