FatFs printing random characters with snprintf

63 Views Asked by At

SD card output:

SD card output

I'm trying to write a string to an SD card using the FatFs library. I'm using the snprintf function to add a variable 'temp' to a string. When the string is written to the SD card there is also random characters there. I've tried using sprintf and also added a null terminator '\0' at the end of the string, but the random characters are always there.

int temp = 20;
char array[200];
snprintf(array, sizeof(array), "Hello there %d", temp);
0

There are 0 best solutions below