Convert string of variable length to floats.

Hello!
Thank you for all replies.
Already managed to fix the problems.

  int x, y, z, grafico;
  int16_t n;
  char buf[7];
  float temperatura;
  int j=0;
  file.open(&root, "LOGTDIA.TXT", O_READ);
  while ((n = file.read(buf, sizeof(buf))) > 0)
 {
if (strlen(buf)==9)
{
 j++;
}
 temperatura = atof(buf);

 if ((temperatura) < 22.5)
 {
 grafico = 190;
 }
 else if ((temperatura) >27.5)
 {
 grafico =30;
 }
 else
 {
 grafico = (190-((temperatura-22.5)*30));
 } 
 setFont(SMALL, 255, 0, 255, 0, 0, 0);
 myGLCD.drawPixel((39+j),grafico);
}
 file.close();
}

Hug.
Fernando Garcia