mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 13:02:59 +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
38
sdk/lib/ucrt/conio/cputs.cpp
Normal file
38
sdk/lib/ucrt/conio/cputs.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// cputs.cpp
|
||||
//
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
//
|
||||
// Defines _cputs(), which writes a string directly to the console.
|
||||
//
|
||||
#include <conio.h>
|
||||
#include <corecrt_internal_lowio.h>
|
||||
|
||||
// Writes the given string directly to the console. No newline is appended.
|
||||
// Returns 0 on success; nonzero on failure.
|
||||
extern "C" int __cdecl _cputs(char const* const string)
|
||||
{
|
||||
_VALIDATE_CLEAR_OSSERR_RETURN(string != nullptr, EINVAL, -1);
|
||||
|
||||
__acrt_lock(__acrt_conio_lock);
|
||||
int result = 0;
|
||||
__try
|
||||
{
|
||||
// Write the string directly to the console. Each character is written
|
||||
// individually, as performance of this function is not considered
|
||||
// critical.
|
||||
for (char const* p = string; *p; ++p)
|
||||
{
|
||||
if (_putch_nolock(*p) == EOF)
|
||||
{
|
||||
result = -1;
|
||||
__leave;
|
||||
}
|
||||
}
|
||||
}
|
||||
__finally
|
||||
{
|
||||
__acrt_unlock(__acrt_conio_lock);
|
||||
}
|
||||
return result;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue