Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
12 years, 5 months ago.
SDFileSystem Fatal errors
If no SD card is connected, the SDFileSystem fopen() function will produce a fatal error (or hang the program). I tried inserting an sd.disk_initialize() function before the fopen() and this prevents the program from hanging. However, attempting to run this same code a second time, hangs the program. Any suggestions for a robust file I/O scheme?
FILE *fp = NULL;
if (sd.disk_initialize()) fp = fopen(fname, "w");
write to file here.
if (fp) fclose(fp);