新手入门
- 积分
- 17
- 金钱
- 17
- 注册时间
- 2016-12-21
- 在线时间
- 24 小时
|
10金钱
FATFS 利用f_lseek函数在文件末尾写数据,但是不成功。
程序如下:
u8 Buffer[2048]="ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1\n";
u8 Buffer1[2048]="ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1ᢿì1òÔØÎļtÏμí3£¬éèÖÃÅì·û1\n";
Open=f_open (&my_file, "SD.txt", FA_CREATE_ALWAYS | FA_READ | FA_WRITE);
Write = f_write (&my_file, Buffer, sizeof(Buffer), &br1); //D′èëêy¾Y
Close=f_close (&my_file);
if(!Close)
{
Open=f_open (&my_file, "SD.txt", FA_WRITE);
Pointer=my_file.fsize;
Res=f_lseek(&my_file,Pointer);
Close = f_write(&my_file, Buffer1, sizeof(Buffer1) , &br1);
f_close(&my_file);
}
|
|