File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 4747| ` fopen ` | ファイルを開く | |
4848| ` fflush ` | ファイルをフラッシュする | |
4949| [ ` fprintf ` ] ( /reference/cstdio/fprintf.md ) | 書式を指定してファイルに出力する | |
50- | ` fscanf ` | 書式を指定してファイルから入力する | |
50+ | [ ` fscanf ` ] ( /reference/cstdio/fscanf.md ) | 書式を指定してファイルから入力する | |
5151| ` vfprintf ` | 可変引数リスト` va_list ` を使用し、書式を指定してファイルに出力する | |
5252| ` vfscanf ` | 可変引数リスト` va_list ` を使用し、書式を指定してファイルから入力する | C++17 |
5353| ` fgetc ` | ファイルから1文字入力する | |
Original file line number Diff line number Diff line change 1+ # fscanf
2+ * cstdio[ meta header]
3+ * std[ meta namespace]
4+ * function[ meta id-type]
5+
6+ ``` cpp
7+ int fscanf ( FILE* restrict stream, const char* restrict format, ... );
8+ ```
9+
10+ ## 概要
11+ 指定されたファイルストリームから、指定された書式文字列を使用してデータを入力する。
12+
13+ ## 例
14+ ```cpp example
15+ #include <cstdio>
16+
17+ int main() {
18+ int n;
19+ const char* path = "test.txt";
20+ std::FILE* fp = std::fopen(path, "r");
21+ std::fscanf(fp, "%d", &n);
22+ std::fclose(fp);
23+ std::printf("%d\n", n);
24+ }
25+ ```
26+ * std::fscanf[ color ff0000]
27+ * std::fopen[ link /reference/cstdio/fopen.md.nolink]
28+ * std::fclose[ link /reference/cstdio/fclose.md.nolink]
29+ * std::FILE[ link /reference/cstdio/file.md.nolink]
30+ ### 出力(test.txtは以下参照)
31+ ```
32+ 123
33+ ```
34+
35+ ### ファイル内容(test.txt)
36+ ```
37+ 123
38+ ```
39+
40+ ## 処理系
41+ - [ Clang] ( /implementation.md#clang ) : ??
42+ - [ GCC] ( /implementation.md#gcc ) : ??
43+ - [ Visual C++] ( /implementation.md#visual_cpp ) : ??
You can’t perform that action at this time.
0 commit comments