- LOG_ERR("Error mounting FAT volume: %d\n", fat_err);
- }
-
- fat_err = fatfile_open(&file, "foo.txt", FA_WRITE | FA_CREATE_ALWAYS);
- ASSERT(fat_err == FR_OK);
-
- size_t count = kfile_write(&file.fd, "Hello, world!", strlen("Hello, world!"));
- ASSERT(count == strlen("Hello, world!"));
+ if(!fat_create_file(dd, FILE_NAME, &dir_entry))
+ {
+ fat_delete_file(fs, &dir_entry);
+ fat_create_file(dd, FILE_NAME, &dir_entry);
+ }