虽然fatfs提供了f_gets,但是没有提供f_getc,为了某些库移植方便,定义了
int f_getc(FIL *fp);
- ff_ex.c
/**
* @file ff_ex.c
* @brief fatfs extensional function.
* @author rgw
* @version 1.0
* @date 2016-12-06
*/
#include "ff.h"
int f_getc (
FIL *fp /* Pointer to the file object */
)
{
BYTE c;
UINT rc;
f_read(fp, &c, 1, &rc);
if (rc != 1)
{
return EOF;
}
return c;
}
- ff_ex.h
/**
* @file ff_ex.h
* @brief fatfs extensional function
* @author rgw
* @version 1.0
* @date 2016-12-06
*/
#ifndef __FF_EX_H
#define __FF_EX_H
int f_getc (FIL *fp); /* Pointer to the file object */
#endif
网友评论