名稱空間
變體
操作

標準庫標頭檔案 <cstdio>

來自 cppreference.com
 
 
標準庫標頭檔案
演算法
<algorithm>
<numeric>
字串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文字處理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
數值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C 相容性
<ccomplex> (C++11/17/20*)
<ciso646> (直到 C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此標頭檔案最初是 C 標準庫的一部分,命名為 <stdio.h>

此標頭檔案是 C 風格輸入/輸出庫的一部分。

目錄

型別

物件型別,能夠儲存控制 C I/O 流所需的所有資訊
(typedef) [編輯]
完整的非陣列物件型別,能夠唯一指定檔案中的位置,包括其多位元組解析狀態
(typedef) [編輯]
sizeof 運算子返回的無符號整型
(typedef) [編輯]

實現定義的空指標常量
(宏常量) [編輯]
與輸入流關聯的 FILE* 型別的表示式
與輸出流關聯的 FILE* 型別的表示式
與錯誤輸出流關聯的 FILE* 型別的表示式
(宏常量) [編輯]
EOF
型別為 int 且值為負的整數常量表達式
(宏常量)
FOPEN_MAX
可以同時開啟的最大檔案數
(宏常量)
FILENAME_MAX
容納最長支援的檔名所需的 char 陣列大小
(宏常量)
BUFSIZ
std::setbuf 使用的緩衝區大小
(宏常量)
_IOFBF_IOLBF_IONBF
std::setbuf 的引數,指示完全緩衝 I/O
std::setbuf 的引數,指示行緩衝 I/O
std::setbuf 的引數,指示無緩衝 I/O
(宏常量)
SEEK_SETSEEK_CURSEEK_END
std::fseek 的引數,指示從檔案開頭查詢
std::fseek 的引數,指示從當前檔案位置查詢
std::fseek 的引數,指示從檔案末尾查詢
(宏常量)
TMP_MAX
std::tmpnam 生成的最大唯一檔名數
(宏常量)
L_tmpnam
容納 std::tmpnam 結果所需的 char 陣列大小
(宏常量)

函式

檔案訪問
開啟檔案
(函式) [編輯]
用不同的名稱開啟一個現有流
(函式) [編輯]
關閉檔案
(函式) [編輯]
將輸出流與實際檔案同步
(函式) [編輯]
為檔案流設定緩衝區
(函式) [編輯]
為檔案流設定緩衝區及其大小
(函式) [編輯]
直接輸入/輸出
從檔案讀取
(函式) [編輯]
寫入檔案
(函式) [編輯]
非格式化輸入/輸出
窄字元
從檔案流中獲取一個字元
(函式) [編輯]
從檔案流獲取字元字串
(函式) [編輯]
向檔案流寫入一個字元
(函式) [編輯]
將字元字串寫入檔案流
(函式) [編輯]
stdin 讀取一個字元
(函式) [編輯]
(C++11 起已棄用)(C++14 起移除)
stdin 讀取一個字串
(函式) [編輯]
stdout 寫入一個字元
(函式) [編輯]
stdout 寫入一個字串
(函式) [編輯]
將一個字元放回檔案流中
(函式) [編輯]
格式化輸入/輸出
窄/多位元組字元
stdin、檔案流或緩衝區讀取格式化輸入
(函式) [編輯]
(C++11)(C++11)(C++11)
stdin、檔案流或緩衝區讀取格式化輸入
使用可變引數列表
(函式) [編輯]
將格式化輸出列印到 stdout、檔案流或緩衝區
(函式) [編輯]
將格式化輸出列印到 stdout、檔案流或緩衝區
使用可變引數列表
(函式) [編輯]
檔案定位
返回當前檔案位置指示器
(函式) [編輯]
獲取檔案位置指示器
(函式) [編輯]
將檔案位置指示器移動到檔案中特定位置
(函式) [編輯]
將檔案位置指示器移動到檔案中特定位置
(函式) [編輯]
將檔案位置指示器移動到檔案開頭
(函式) [編輯]
錯誤處理
清除錯誤
(函式) [編輯]
檢查檔案結束
(函式) [編輯]
檢查檔案錯誤
(函式) [編輯]
將當前錯誤的字串顯示到 stderr
(函式) [編輯]
檔案操作
擦除檔案
(函式) [編輯]
重新命名檔案
(函式) [編輯]
建立並開啟一個臨時檔案,該檔案將自動刪除
(函式) [編輯]
返回一個唯一的檔名
(函式) [編輯]

[編輯] 概要

namespace std {
  using size_t = /* see description */;
  using FILE = /* see description */;
  using fpos_t = /* see description */;
}
 
#define NULL /* see description */
#define _IOFBF /* see description */
#define _IOLBF /* see description */
#define _IONBF /* see description */
#define BUFSIZ /* see description */
#define EOF /* see description */
#define FOPEN_MAX /* see description */
#define FILENAME_MAX /* see description */
#define L_tmpnam /* see description */
#define SEEK_CUR /* see description */
#define SEEK_END /* see description */
#define SEEK_SET /* see description */
#define TMP_MAX /* see description */
#define stderr /* see description */
#define stdin /* see description */
#define stdout /* see description */
 
namespace std {
  int remove(const char* filename);
  int rename(const char* old_p, const char* new_p);
  FILE* tmpfile();
  char* tmpnam(char* s);
  int fclose(FILE* stream);
  int fflush(FILE* stream);
  FILE* fopen(const char* filename, const char* mode);
  FILE* freopen(const char* filename, const char* mode, FILE* stream);
  void setbuf(FILE* stream, char* buf);
  int setvbuf(FILE* stream, char* buf, int mode, size_t size);
  int fprintf(FILE* stream, const char* format, ...);
  int fscanf(FILE* stream, const char* format, ...);
  int printf(const char* format, ...);
  int scanf(const char* format, ...);
  int snprintf(char* s, size_t n, const char* format, ...);
  int sprintf(char* s, const char* format, ...);
  int sscanf(const char* s, const char* format, ...);
  int vfprintf(FILE* stream, const char* format, va_list arg);
  int vfscanf(FILE* stream, const char* format, va_list arg);
  int vprintf(const char* format, va_list arg);
  int vscanf(const char* format, va_list arg);
  int vsnprintf(char* s, size_t n, const char* format, va_list arg);
  int vsprintf(char* s, const char* format, va_list arg);
  int vsscanf(const char* s, const char* format, va_list arg);
  int fgetc(FILE* stream);
  char* fgets(char* s, int n, FILE* stream);
  int fputc(int c, FILE* stream);
  int fputs(const char* s, FILE* stream);
  int getc(FILE* stream);
  int getchar();
  int putc(int c, FILE* stream);
  int putchar(int c);
  int puts(const char* s);
  int ungetc(int c, FILE* stream);
  size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream);
  size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream);
  int fgetpos(FILE* stream, fpos_t* pos);
  int fseek(FILE* stream, long int offset, int whence);
  int fsetpos(FILE* stream, const fpos_t* pos);
  long int ftell(FILE* stream);
  void rewind(FILE* stream);
  void clearerr(FILE* stream);
  int feof(FILE* stream);
  int ferror(FILE* stream);
  void perror(const char* s);
}

[編輯] 注意