1

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);
Barmar
  • 741,623
  • 53
  • 500
  • 612

0 Answers0