Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux教程 >> linux標准IO學習

linux標准IO學習

日期:2017/2/7 14:29:03      編輯:Linux教程
 

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 © Windows教程網 All Rights Reserved