打开文件的出现错误,不明原因!求解答 //挂载文件系统
res=f_mount(&fs,"0:",0);
if(res != FR_OK){
printf("mount filesystem 0 failed : %d
",res);
}
//写文件测试
printf("write file test......
");
res = f_open(&fdst, "0:/msg.txt", FA_CREATE_ALWAYS | FA_WRITE);
if(res != FR_OK){
printf("open file error : %d
",res);
}else{
res = f_write(&fdst, textFileBuffer, sizeof(textFileBuffer), &bw); /* Write it to the dst file */
if(res == FR_OK){
printf("write data ok! %d
",bw);
}else{
printf("write data error : %d
",res);
}
/*close file */
f_close(&fdst);
} |