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)

上一篇:SQL Server时间算法总结


下一篇:使用VM虚拟机安装CentOS-stream系统