|
用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("\n\f_open is ok\n");
fresult = f_write (&g_sFileObject, buf1, sizeof (buf1) - 1, &bytesWritten);
f_sync (&g_sFileObject);
if(fresult == FR_OK)
{
UARTprintf("\n\f_write is ok\n");
UARTprintf("%d\n",bytesWritten);
}
else
{
UARTprintf("\n\f_write is fail\n");
}
}
else
{
UARTprintf("\n\f_open is fail\n");
}
|
|