用FATFS写一个文件到SD卡中,比如WR.txt,内容为“THIS IS APPLE”,如果想在这个文件中续写一个“THIS IS APPLE”,应该如何操作???
fresult = f_open(&g_sFileObject, g_cCmdBuf, FA_READ | FA_CREATE_ALWAYS | FA_WRITE);
f_sync (&g_sFileObject);
if(fresult == FR_OK)
{
UARTprintf("
f_open is ok
");
fresult = f_write (&g_sFileObject, buf1, sizeof (buf1) - 1, &bytesWritten);
f_sync (&g_sFileObject);
if(fresult == FR_OK)
{
UARTprintf("
f_write is ok
");
UARTprintf("%d
",bytesWritten);
}
else
{
UARTprintf("
f_write is fail
");
}
}
else
{
UARTprintf("
f_open is fail
");
}
此帖出自
小平头技术问答
2、打开文件后移动文件指针到最后,再写。
一周热门 更多>