C语言文件读取和写入

打开文件

FILE *fopen(const char *filename, const char *mode)

关闭文件

int fclose(FILE *stream)

读取字符

int getc(FILE *stream)

写入字符

int putc(int char, FILE *stream)

fprintf

int fprintf(FILE *stream, const char *format, ...)

fscanf

int fscanf(FILE *stream, const char *format, ...)

fputs

int fputs(const char *str, FILE *stream)

fgets

char *fgets(char *str, int n, FILE *stream)

fseek

int fseek(FILE *stream, long int offset, int whence)
SEEK_SET Beginning of file
SEEK_CUR Current position of the file pointer
SEEK_END End of file

ftell

long int ftell(FILE *stream)

ffush

long int ftell(FILE *stream)

fread

size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream)

fwrite

size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream)

posted @ 2021-12-25 17:48  那个白熊  阅读(598)  评论(0编辑  收藏  举报