本帖最后由 MOMO2333 于 2018-2-25 19:29 编辑
读取SD卡TXT文件,每次读一个扇区,并通过esp8266发送,但是现在只能发送TXT内容的一半,请问大家遇到过这种情况吗?
- void txt_trans(u8 *pname)
- {
- FATFS FatFs; /* Work area (filesystem object) for logical drive */
- UINT brr ;
- u8 ress;
- FRESULT fr; /* FatFs return code */
- u8 *databuf; //Ò»ÐÐÊý¾Ý»º´æÇøµØÖ·
-
-
- FIL fil; /* File object */
- databuf=(u8*)pic_memalloc(512);
-
- /* Register work area to the default drive */
- f_mount(&FatFs, "", 0);
-
- /* Open a text file */
- fr = f_open(&fil,(const TCHAR*)pname, FA_READ);
- /* Read all lines and display it */
-
- for (;;)
- {
- memset(databuf,0,512);
- ress=f_read(&fil,databuf,512, &brr);
- if(ress==FR_OK)
- {
- atk_8266_wifiap_send(databuf);
- }
-
- if(f_eof(&fil)) {break;} // over
- }
-
- /* Close the file */
- f_close(&fil);
- pic_memfree(databuf);
-
- }
|