次のコードブロックを参照してください。fcloseを呼び出す前にFILEオブジェクトが閉じられていないことを確認するにはどうすればよいですか?ところで、fcloseを2回呼び出すのは安全ですか?
FILE* f = fopen('test.txt')
//some code here, f may be closed by someone, but they may not set it to NULL
...
/// I want to make sure f is not closed before, how can I do it here?
if(...)
{
fclose(f)
}