Skip to content

Commit 3f4fdd5

Browse files
committed
new page reference/cstdio/fscanf.md
1 parent 7e71dfc commit 3f4fdd5

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

reference/cstdio.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
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文字入力する | |

reference/cstdio/fscanf.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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): ??

0 commit comments

Comments
 (0)