1.fopen()開啟檔案,返回流
file* fopen(const char * path, const char * mode);
2.fdopen()通過檔案描述符開啟檔案
file * fdopen (int fd, const char *mode);
3.fclose()關閉檔案
int fclose (file *stream);
4.fcloseall()關閉所有檔案
int fcloseall (void);
5.fgetc()讀取單個字元
int fgetc (file *stream);
6.ungetc()將字元放回流
int ungetc (int c, file *stream);
7.fgets()按行讀取字串
char * fgets (char *str, int size, file *stream);
8.fread()讀取二進位制
size_t fread (void *buf, size_t size, size_t nr,file *stream);
9.fputc()寫入單個字元
int fputc (int c, file *stream);
10.fputs()寫入字串
int fputs (const char *str, file *stream);
11.fwrite()寫入二進位制資料
size_t fwrite (void *buf,size_t size,size_t nr,file *stream);
12.定位流
fseek()函式
int fseek (file *stream, long offset, int whence);//將流設定到whence規定的offset處(whence的取值可以是seek_set、seek_cur、seek_end)
fsetpos()函式
int fsetpos (file *stream, fpos_t *pos);//將流設定到pos處
rewind()函式
void rewind (file *stream);//將流設定到開始位置
13.ftell()返回當前流的位置
long ftell (file *stream);
14.fgetpos()獲得當前流的位置設定到pos中
int fgetpos (file *stream, fpos_t *pos);
15.fflush()將資料刷到核心緩衝區中
int fflush (file *stream);
16.ferror()檢測錯誤標誌
int ferror (file *stream);
17.feof()檢測檔案結尾標誌
int feof (file *stream);
18.clearerr()清空錯誤和檔案結尾標誌
void clearerr (file *stream);
19.fileno()獲取檔案描述符
int fileno (file *stream);
20.setvbuf()設定乙個指向buf區域size大小的緩衝,mode表示緩衝模式(_ionbf、_iolbf、_iofbf)
int setvbuf (file *stream, char *buf, int mode,size_t size);
21.flockfile()檔案加鎖
void flockfile (file *stream);
22.funlockfile()、ftrylockfile()減少與流相關的鎖計數
void funlockfile (file *stream);
int ftrylockfile (file *stream);
23.不加鎖函式
int fgetc_unlocked (file *stream);
char *fgets_unlocked (char *str, int size, file *stream);
size_t fread_unlocked (void *buf, size_t size,size_t nr,file *stream);
int fputc_unlocked (int c, file *stream);
int fputs_unlocked (const char *str, file *stream);
size_t fwrite_unlocked (void *buf, size_t size,size_t nr,file *stream);
int fflush_unlocked (file *stream);
int feof_unlocked (file *stream);
int ferror_unlocked (file *stream);
int fileno_unlocked (file *stream);
void clearerr_unlocked (file *stream);
緩衝輸入輸出
cpp view plain copy 1.fopen 開啟檔案,返回流 file fopen const char path,const char mode 2.fdopen 通過檔案描述符開啟檔案 file fdopen intfd,const char mode 3.fclose 關閉檔案 i...
輸入輸出流緩衝
每乙個輸入輸出流都包含乙個指標,指向某種streambuf 即流緩衝,這依賴於它是否處理標準i o 檔案 記憶體等 我們可以直接訪問 streambuf。例如,可以向streambuf移進 移出原始位元組,而不必通 過輸入輸出流來格式化它們。當然,這時通過呼叫streambuf物件的 成員函式來完成...
Redis 輸入輸出緩衝區
id 客戶端連線的唯一標識,這個id是隨著redis的連線自增的,重啟redis後會重置為0 addr 客戶端連線的ip和埠 fd socket的檔案描述符,與lsof命令結果中的fd是同乙個,如果fd 1代表當前客戶端不是外部客戶端,而是redis內部的偽裝客戶端。name 客戶端的名字,後面的c...