/*##-4- Close the open text files ################################*/
retSD = f_close(&fil);
if(retSD)
{
printf(" close error : %d\r\n",retSD);
}
else
{
printf(" close sucess!!! \r\n");
}
/*##-5- Open the text files object with read access ##############*/
retSD = f_open(&fil, filename, FA_READ);
if(retSD)
{
printf(" open file error : %d\r\n",retSD);
}
else
{
printf(" open file sucess!!! \r\n");
}
/*##-6- Read data from the text files ##########################*/
retSD = f_read(&fil, rtext, sizeof(rtext), (UINT*)&bytesread);
if(retSD)
{
printf(" read error!!! %d\r\n",retSD);
}
else
{
printf(" read sucess!!! \r\n");
printf(" read Data : %s\r\n",rtext);
}
/*##-7- Close the open text files ############################*/
retSD = f_close(&fil);
if(retSD)
{
printf(" close error!!! %d\r\n",retSD);
}
else
{
printf(" close sucess!!! \r\n");
}
/*##-8- Compare read data with the expected data ############*/
if(bytesread == byteswritten)
{
printf(" FatFs is working well!!!\r\n");
}
retSD=f_mount(0, "0", 0);