| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files (x86)/Windows Kits/10/Source/10.0.19041.0/ucrt/stdio/ |
Upload File : |
//
// closeall.cpp
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Defines _fcloseall(), which closes all opened files.
//
#include <corecrt_internal_stdio.h>
// Closes all streams currently open except for stdin, stdout, and stderr. All
// tmpfile()-created streams are closed as well. Returns EOF on failure; returns
// the number of closed streams on success.
extern "C" int __cdecl _fcloseall()
{
int count = 0;
__acrt_lock(__acrt_stdio_index_lock);
__try
{
for (int i = _IOB_ENTRIES; i != _nstream; ++i)
{
if (__piob[i] == nullptr)
continue;
// If the stream is in use, close it:
if (__crt_stdio_stream(__piob[i]).is_in_use() && fclose(&__piob[i]->_public_file) != EOF)
{
++count;
}
DeleteCriticalSection(&__piob[i]->_lock);
_free_crt(__piob[i]);
__piob[i] = nullptr;
}
}
__finally
{
__acrt_unlock(__acrt_stdio_index_lock);
}
return count;
}