Skip to content

Commit c01cef2

Browse files
committed
new page: fclose.md
1 parent ec127b7 commit c01cef2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

reference/cstdio/fclose.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# fclose
2+
* cstdio[meta header]
3+
* std[meta namespace]
4+
* function[meta id-type]
5+
6+
```cpp
7+
int fclose(FILE* stream);
8+
```
9+
10+
## 概要
11+
ファイルを閉じる。
12+
13+
原則、開かれたファイルはプロセスが終了する前にこれを呼び出すことが望ましい。
14+
15+
`fclose`によって閉じられたファイルストリームは無効になり、そのファイルストリームに対する以降の操作は未定義動作となる。
16+
17+
## 戻り値
18+
正常に実行されれば、`0`を返す。
19+
20+
バッファーのフラッシュ時にエラーが発生した場合、もしくはデータの出力時に障害が発生すると`EOF`を返す。
21+
22+
それ以外のエラーは処理系依存である。
23+
24+
## 例
25+
```cpp example
26+
#include <cstdio>
27+
28+
int main() {
29+
FILE *fp = fopen("test.txt", "w");
30+
fclose(fp);
31+
}
32+
```
33+
34+
## 処理系
35+
- [Clang](/implementation.md#clang): ??
36+
- [GCC](/implementation.md#gcc): ??
37+
- [Visual C++](/implementation.md#visual_cpp): ??

0 commit comments

Comments
 (0)