read int/long from sd card

PaulS, like this is better?

char fileStr[] = "987654"; // example of what is in the file

char result[7]; // value are between 0/999940? so lenght is 6 characters + 1 ('\0')
uint8_t i = 0; // a counter

while (fileStr[i] != '\0' && i < sizeof(result) - 1) // while character isn't the string terminator
{
  result[i] = fileStr[i]; // store character in result
  i++; // increase counter
}
result[i] = '\0';

unsigned long number = atol(result); // convert result string to numeric value
Serial.print(number); // print the number

But both are working I have tested :slight_smile: