Convert string of variable length to floats.

PaulS:
So, post the code where you are properly reading data from the card.

void tempgScreen()
{
  t=rtc.getTime();
  int x, y, z, grafico, hora;
  int16_t n;
  char buf[7];
  float temperatura;
  
  file.open(&root, "LOGTDIA.TXT", O_READ);
while ((n = file.read(buf, sizeof(buf))) > 0)
{
  
hora = (t.hour*60)+t.min;

temperatura = atof(buf);

if ((temperatura) < 22.5)
{
grafico = 190;
}
else if ((temperatura) >27.5)
{
grafico =30;
}
else
{
grafico = (190-((temperatura-22.5)*30));
}

for (uint8_t j=0; j <=(hora/6) ;j++)
{
setFont(SMALL, 255, 0, 255, 0, 0, 0);
myGLCD.drawPixel((40+j),grafico);
}

}