user7636: I have logged  some data in my sdcard/FAT32 (format).
I can read and display them on the serial monitor but additionally I want to use these data as float.
Here is my code:
       byte index = 0;

       Tfile = SD.open("DATALOG.TXT",FILE_READ); 

       while (Tfile.available()) {

         x[index++] = Tfile.read();
         x[index] = '\0'; // NULL terminate the array
       }

Printing the data using: 
   Serial.print(fileContents);

I receive  the following float values that are correct:
   .63
   15.63
   16.60
   16.60
   16.60
   16.60
   etc

Now I want to work with values so i need to store them on a double index:
    double dtemp[320];
    for(index = 0, i=0; index < 320; index++, i++) {
       dtemp[i] =  fileContents[index];
       Serial.println(dtemp[i]); }

but i receive fault values:
      46.00
      54.00
      51.00
      13.00
      10.00
      49.00
      53.00
      etc

Any comment is welcomed !
Thank you in advance !

user7508: You have to parse the character array in order to convert it to
floats. There is no fast way to do this: since the Arduino has no FPU,
anything involving floats is slow.
Unless you really have to, I would not recommend slurping the whole file
into RAM. You will save memory by parsing the file on the fly. This
should be as simple as calling the parseFloat() method of the File
object:
double dtemp[320];
int i;
for (i = 0; Tfile.avalable() && i < 320; i++) {
    dtemp[i] = Tfile.parseFloat();
    Serial.println(dtemp[i]);
}
if (i < 320)
    Serial.println("WARNING: Premature end of file.");


7636: <p>I have logged  some data in my sdcard/FAT32 (format).
I can read and display them on the serial monitor but additionally I want to use these data as float.</p>

<p>Here is my code:</p>

<pre><code>       byte index = 0;

       Tfile = SD.open("DATALOG.TXT",FILE_READ); 

       while (Tfile.available()) {

         x[index++] = Tfile.read();
         x[index] = '\0'; // NULL terminate the array
       }
</code></pre>

<p>Printing the data using: </p>

<pre><code>   Serial.print(fileContents);
</code></pre>

<p>I receive  the following float values that are correct:</p>

<pre><code>   .63
   15.63
   16.60
   16.60
   16.60
   16.60
   etc
</code></pre>

<p>Now I want to work with values so i need to store them on a double index:</p>

<pre><code>    double dtemp[320];
    for(index = 0, i=0; index &lt; 320; index++, i++) {
       dtemp[i] =  fileContents[index];
       Serial.println(dtemp[i]); }
</code></pre>

<p>but i receive fault values:</p>

<pre><code>      46.00
      54.00
      51.00
      13.00
      10.00
      49.00
      53.00
      etc
</code></pre>

<p>Any comment is welcomed !</p>

<p>Thank you in advance !</p>
 7508: <p>You have to <em>parse</em> the character array in order to convert it to
floats. There is no fast way to do this: since the Arduino has no FPU,
<em>anything</em> involving floats is slow.</p>

<p>Unless you really have to, I would not recommend slurping the whole file
into RAM. You will save memory by parsing the file on the fly. This
should be as simple as calling the <code>parseFloat()</code> method of the <code>File</code>
object:</p>

<pre class="lang-c++ prettyprint-override"><code>double dtemp[320];
int i;
for (i = 0; Tfile.avalable() &amp;&amp; i &lt; 320; i++) {
    dtemp[i] = Tfile.parseFloat();
    Serial.println(dtemp[i]);
}
if (i &lt; 320)
    Serial.println("WARNING: Premature end of file.");
</code></pre>
