The ANSI-C library contains a fairly large interface for file I/O. In microcontroller applications however, one usually does not need file I/O. In the few cases where one would need it, the implementation depends on the actual setup of the target system. Therefore, it is impossible for Freescale to provide an implementation for these features that the user has to specifically implement.
The following listing contains file I/O functions while Listing: ANSI-C functions for writing and reading characters has functions for the reading and writing of characters. The functions for reading and writing blocks of data are found in Listing: ANSI-C functions for reading and writing blocks of data. Functions for formatted I/O on files are found in Listing: ANSI-C formatted I/O functions on files, and Listing: ANSI-C positioning functions has functions for positioning data within files.
FILE* fopen(const char *name, const char *mode); FILE* freopen(const char *name, const char *mode, FILE *f); int fflush(FILE *f); int fclose(FILE *f); int feof(FILE *f); int ferror(FILE *f); void clearerr(FILE *f); int remove(const char *name); int rename(const char *old, const char *new); FILE* tmpfile(void); char* tmpnam(char *name); void setbuf(FILE *f, char *buf); int setvbuf(FILE *f, char *buf, int mode, size_t size);
int fgetc(FILE *f); char* fgets(char *s, int n, FILE *f); int fputc(int c, FILE *f); int fputs(const char *s, FILE *f); int getc(FILE *f); int getchar(void); char* gets(char *s); int putc(int c, FILE *f); int puts(const char *s); int ungetc(int c, FILE *f);
size_t fread(void *buf, size_t size, size_t n, FILE *f); size_t fwrite(void *buf, size_t size, size_t n, FILE *f);
int fprintf(FILE *f, const char *format, ...); int vfprintf(FILE *f, const char *format, va_list args); int fscanf(FILE *f, const char *format, ...); int printf(const char *format, ...); int vprintf(const char *format, va_list args); int scanf(const char *format, ...);
int fgetpos(FILE *f, fpos_t *pos); int fsetpos(FILE *f, const fpos_t *pos); int fseek(FILE *f, long offset, int mode); long ftell(FILE *f); void rewind(