【實用手記】IO函數原型

系統/文件IO     .....返回及使用文件描述符
open


       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>


       int open(const char *pathname, int flags);


close


       #include <unistd.h>


       int close(int fd);


read


       #include <unistd.h>


       ssize_t read(int fd, void *buf, size_t count);




write


       #include <unistd.h>


       ssize_t write(int fd, const void *buf, size_t count);




lseek


       #include <sys/types.h>
       #include <unistd.h>


       off_t lseek(int fd, off_t offset, int whence);
標準IO          .....返回及使用文件指針
fopen

       #include <stdio.h>

       FILE *fopen(const char *path, const char *mode);

       FILE *fdopen(int fd, const char *mode);

fclose

       #include <stdio.h>

       int fclose(FILE *fp);

fread

       #include <stdio.h>

       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);


fseek

       #include <stdio.h>

       int fseek(FILE *stream, long offset, int whence);

ftell

       long ftell(FILE *stream);


目錄IO          .....返回及使用目錄指針
opendir

       #include <sys/types.h>
       #include <dirent.h>

       DIR *opendir(const char *name);

closedir

       #include <sys/types.h>

       #include <dirent.h>

       int closedir(DIR *dirp);

chdir

       #include <unistd.h>

       int chdir(const char *path);

readdir

       #include <dirent.h>

       struct dirent *readdir(DIR *dirp);

rewinddir

       #include <sys/types.h>
       #include <dirent.h>

       void rewinddir(DIR *dp);


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章