初级会员

- 积分
- 87
- 金钱
- 87
- 注册时间
- 2013-4-25
- 在线时间
- 10 小时
|

楼主 |
发表于 2014-7-27 17:33:35
|
显示全部楼层
回复【2楼】guooay耀:
---------------------------------
有啊,我这个是循环写入的,写完之后会close的
res = f_open(&file, path, FA_WRITE|FA_OPEN_ALWAYS);
if(FR_OK != res)
{ //文件打开错误
xprintf("\n\nSD %s open file error: %d !\n\r", path, res);
f_close(&file);
return 1;
}
else
{
if((totallen%CAMERAPAKLEN)==0)
pak_num = totallen/CAMERAPAKLEN;
else
pak_num = totallen/CAMERAPAKLEN + 1;
for(j = 0;j < pak_num;j++)
{
for(k=0;k<20;k++)
{
check_lcddevice_linktime();
pak_lenth = camera_readdata(i, totallen, j);
if(pak_lenth>0)
{
res = f_write(&file, (const char*)CameraReceiveBuf + 5, pak_lenth, &bw);//sizeof(sd_buffer)
if((!bw) || (res != FR_OK)) /*EOF or Error*/
{
xprintf("write error\n");
f_close(&file);
return 1;
}
f_sync(&file);
break;
}
}
xprintf("recv photo data lenth %d\n",pak_lenth);
}
}
}
f_close(&file);
xprintf("\r\n=====write photo data Done!!=====\r\n\r\n"); |
|