ReactOS 0.4.16-dev-963-g182f353
clearerr.cpp
Go to the documentation of this file.
1//
2// clearerr.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines clearerr(), which clears error and EOF flags from a stream.
7//
9
10
11
12extern "C" errno_t __cdecl clearerr_s(FILE* const public_stream)
13{
14 __crt_stdio_stream const stream(public_stream);
15
17
18 _lock_file(stream.public_stream());
19 __try
20 {
21 stream.unset_flags(_IOERROR | _IOEOF); // Clear stdio flags
22 _osfile_safe(_fileno(stream.public_stream())) &= ~(FEOFLAG); // Clear lowio flags
23 }
25 {
26 _unlock_file(stream.public_stream());
27 }
29
30 return 0;
31}
32
33
34
35extern "C" void __cdecl clearerr(FILE* const stream)
36{
38}
#define EINVAL
Definition: acclib.h:90
#define __cdecl
Definition: accygwin.h:79
void __cdecl clearerr(FILE *const stream)
Definition: clearerr.cpp:35
errno_t __cdecl clearerr_s(FILE *const public_stream)
Definition: clearerr.cpp:12
_Check_return_ _CRTIMP int __cdecl _fileno(_In_ FILE *_File)
_CRTIMP void __cdecl _unlock_file(_Inout_ FILE *_File)
#define _IOEOF
Definition: stdio.h:132
_CRTIMP void __cdecl _lock_file(_Inout_ FILE *_File)
#define _VALIDATE_RETURN_ERRCODE(expr, errorcode)
#define __try
Definition: pseh2_64.h:188
#define __endtry
Definition: pseh2_64.h:191
#define __finally
Definition: pseh2_64.h:190
#define _osfile_safe(i)
Definition: internal.h:78
Definition: parse.h:23
int errno_t
Definition: corecrt.h:615