res = f_open(&f_ma, "0:manager.txt",FA_CREATE_NEW);
if(res == FR_OK)
{
res = f_open(&f_ma, "0:manager.txt",FA_WRITE);
if(res == FR_OK)
{
res = f_write(&f_ma, towrite, strlen((char *)towrite), &bw);
f_putc('\n',&f_ma);
}
if(res == FR_OK)
{
res = f_write(&f_ma, towrite1, strlen((char *)towrite1), &bw);
f_putc('\n',&f_ma);
}
}
if(res == FR_OK)
f_close(&f_ma);
如上代码 我写了两行文本到manager.txt中
怎么一次读取一行直至读完呢?
int i = 0;
while(f_eof(&f_ma))
{
f_gets(buffer,20,&f_ma);
i++;
}
这样有问题吗?为什么读出来buffer[0]里面读出了两行数据? |