ReactOS 0.4.16-dev-927-g467dec4
putw.cpp
Go to the documentation of this file.
1//
2// putw.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines _putw(), which writes a binary integer to a stream.
7//
9
10
11
12// Writes the binary int value to the stream, byte-by-byte. On success, returns
13// the value written; on failure, returns EOF. Note, however, that the value may
14// be EOF--that is, after all, a valid integer--so be sure to test ferror() and
15// feof() to check for error conditions.
16extern "C" int __cdecl _putw(int const value, FILE* const stream)
17{
18 _VALIDATE_RETURN(stream != nullptr, EINVAL, EOF);
19
20 int return_value = EOF;
21
23 __try
24 {
25 char const* const first = reinterpret_cast<char const*>(&value);
26 char const* const last = first + sizeof(value);
27 for (char const* it = first; it != last; ++it)
28 {
30 }
31
32 if (ferror(stream))
33 __leave;
34
35 return_value = value;
36 }
38 {
40 }
42
43 return return_value;
44}
#define EINVAL
Definition: acclib.h:90
#define __cdecl
Definition: accygwin.h:79
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
const GLint * first
Definition: glext.h:5794
_Check_return_ _CRTIMP int __cdecl ferror(_In_ FILE *_File)
#define EOF
Definition: stdio.h:24
_CRTIMP void __cdecl _unlock_file(_Inout_ FILE *_File)
#define _fputc_nolock(_c, _stream)
Definition: stdio.h:1143
_CRTIMP void __cdecl _lock_file(_Inout_ FILE *_File)
static UINT UINT last
Definition: font.c:45
#define __try
Definition: pseh2_64.h:188
#define __leave
Definition: pseh2_64.h:192
#define __endtry
Definition: pseh2_64.h:191
#define __finally
Definition: pseh2_64.h:190
int __cdecl _putw(int const value, FILE *const stream)
Definition: putw.cpp:16
Definition: parse.h:23
Definition: pdh_main.c:96
#define const
Definition: zconf.h:233