mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:02:56 +00:00
[UCRT] Import Microsoft.Windows.SDK.CRTSource version 10.0.22621.3
Imported from https://www.nuget.org/packages/Microsoft.Windows.SDK.CRTSource/10.0.22621.3 License: MIT
This commit is contained in:
parent
f1b60c66f0
commit
04e0dc4a7a
568 changed files with 115483 additions and 0 deletions
43
sdk/lib/ucrt/stdio/putw.cpp
Normal file
43
sdk/lib/ucrt/stdio/putw.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
//
|
||||
// putw.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Defines _putw(), which writes a binary integer to a stream.
|
||||
//
|
||||
#include <corecrt_internal_stdio.h>
|
||||
|
||||
|
||||
|
||||
// Writes the binary int value to the stream, byte-by-byte. On success, returns
|
||||
// the value written; on failure, returns EOF. Note, however, that the value may
|
||||
// be EOF--that is, after all, a valid integer--so be sure to test ferror() and
|
||||
// feof() to check for error conditions.
|
||||
extern "C" int __cdecl _putw(int const value, FILE* const stream)
|
||||
{
|
||||
_VALIDATE_RETURN(stream != nullptr, EINVAL, EOF);
|
||||
|
||||
int return_value = EOF;
|
||||
|
||||
_lock_file(stream);
|
||||
__try
|
||||
{
|
||||
char const* const first = reinterpret_cast<char const*>(&value);
|
||||
char const* const last = first + sizeof(value);
|
||||
for (char const* it = first; it != last; ++it)
|
||||
{
|
||||
_fputc_nolock(*it, stream);
|
||||
}
|
||||
|
||||
if (ferror(stream))
|
||||
__leave;
|
||||
|
||||
return_value = value;
|
||||
}
|
||||
__finally
|
||||
{
|
||||
_unlock_file(stream);
|
||||
}
|
||||
|
||||
return return_value;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue