OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 2950|回复: 2

f_write文件只能写2次

[复制链接]

11

主题

30

帖子

0

精华

初级会员

Rank: 2

积分
91
金钱
91
注册时间
2014-8-24
在线时间
76 小时
发表于 2016-3-29 20:03:37 | 显示全部楼层 |阅读模式
5金钱
         res=f_open(file,file_name2,FA_OPEN_EXISTING|FA_WRITE);
                                for(kq=0;kq<lenlen;kq++)
                                 {
                                        py[kq]=px[0][kq];                       
                                 }       
         res = f_write(file,py,lenlen,&bw1);
                                 res = f_lseek(file,lenlen);
                                for(kq=0;kq<lenlen;kq++)
                                 {
                                        py[kq]=px[1][kq];                       
                                 }       
         res = f_write(file,py,lenlen,&bw1);
                                 res = f_lseek(file,lenlen);
         res = f_lseek(file,lenlen);                                 
                                for(kq=0;kq<lenlen;kq++)
                                 {
                                        py[kq]=px[2][kq];                       
                                 }       
         res = f_write(file,py,lenlen,&bw1);
                                 res = f_lseek(file,lenlen);
         res = f_lseek(file,lenlen);
         res = f_lseek(file,lenlen);       
                                for(kq=0;kq<lenlen;kq++)
                                 {
                                        py[kq]=px[3][kq];                       
                                 }       
         res = f_write(file,py,lenlen,&bw1);
         res = f_lseek(file,lenlen);
         res = f_lseek(file,lenlen);
         res = f_lseek(file,lenlen);       
         res = f_lseek(file,lenlen);       
f_close(file);
用这种最笨的方法也只能写2次!

正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

11

主题

30

帖子

0

精华

初级会员

Rank: 2

积分
91
金钱
91
注册时间
2014-8-24
在线时间
76 小时
 楼主| 发表于 2016-3-29 20:18:10 | 显示全部楼层
就算指针移动有问题也不应该只写2次,我可是要学几十次的。
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2016-3-29 20:49:48 | 显示全部楼层
根据返回值自己分析问题.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-6-19 07:58

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表