Hi,
I’m using LittleFileSystem and want to write and read a float from a txt file.
FILE *f = fopen("/fs/numbers.txt", "r+");
float number = 12.12f;
// Store number
fprintf(f, "%f\n", number);
fflush(f);
// close file and reopen
float c;
while (!feof(f)) {
fscanf(f, "%f\n", &c);
printf("number: %f", c);
}
But I couldn’t get float c’s value from file, in terminal I only got this:
numbers:
I wonder why float value can’t be read correctly