歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

linux標准IO學習

FILE *fopen(const char* pathname, const char* type);
int fclose(FILE *fp);
int fgetc(FILE *fp);
int fputc(int c, FILE *fp);
char *fgets(char *buf, int n, FILE *fp);
int fputs(const char *str, FILE *fp);
以上,返回值為int類型的,如果出錯則返回EOF,其余藍色的返回值為指針,出錯為NULL
讀寫二進制
size_t fread(void *ptr, size_t size, size_t nobj, FILE *fp)
size_t fwrite(void *ptr, size_t size, size_t nobj, FILE *fp)

linux系統IO(非標准)
int open(const char* path, int oflag)
ssize_t read(int fd, void *buf, size_t nbytes)
ssize_t write(int fd, void *buf, size_t nbytes)
off_t lseek(int fd, off_t offset, int whence)
close(fd)

Copyright © Linux教程網 All Rights Reserved