高中生
最后登录1970-1-1
在线时间 小时
注册时间2015-12-20
|
for ( i=0; i<512; i++ ) //填充缓冲
{
Tx_Buffer =0xab;
}
// f_mount(fs[0],"0:",1);
res = f_open(&fnew,"0:/newfile.txt2" , FA_CREATE_ALWAYS| FA_WRITE);
if(res==FR_OK)
{
//res = f_lseek(file, f_size(file));
res = f_write(&fnew, Tx_Buffer,512, &bw);
delay_ms(500);
}
f_close(&fnew);
res = f_open(&fnew,"0:/newfile.txt2" ,FA_OPEN_EXISTING|FA_READ);
res=f_read(&fnew,Rx_Buffer,512,&br);
if(res)
{
printf("Read Error:%d\r\n",res);
}else
{
for(t=0;t<br;t++)
{
printf("OX%04X ",Rx_Buffer[t]);
// printf("%02x ",Rx_Buffer[t]);
}
}
f_close(&fnew);
f_mount(NULL,"0:",1);
为什么最后打印出来前255个字节是正确的,后边全为0了,我明明写进去的是516个字节的,为什么写不进去,或者读的不对呢?找不到原因了
|
|