ReactOS
0.4.16-dev-1946-g52006dd
wcsncpy.cpp
Go to the documentation of this file.
1
//
2
// wcsncpy.cpp
3
//
4
// Copyright (c) Microsoft Corporation. All rights reserved.
5
//
6
// Defines wcsncpy(), which copies a string from one buffer to another. This
7
// function copies at most 'count' characters. If fewer than 'count' characters
8
// are copied, the rest of the buffer is padded with null characters.
9
//
10
#include <string.h>
11
12
#pragma warning(disable:__WARNING_POSTCONDITION_NULLTERMINATION_VIOLATION)
// 26036
13
14
15
#ifdef _M_ARM
16
#pragma function(wcsncpy)
17
#endif
18
19
20
21
extern
"C"
wchar_t
*
__cdecl
wcsncpy
(
22
wchar_t
*
const
destination,
23
wchar_t
const
*
const
source
,
24
size_t
const
count
25
)
26
{
27
size_t
remaining =
count
;
28
29
wchar_t
* destination_it = destination;
30
wchar_t
const
* source_it =
source
;
31
while
(remaining != 0 && (*destination_it++ = *source_it++) != 0)
32
{
33
--remaining;
34
}
35
36
if
(remaining != 0)
37
{
38
while
(--remaining != 0)
39
{
40
*destination_it++ =
L
'\0'
;
41
}
42
}
43
44
return
destination;
45
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
wcsncpy
wcsncpy
Definition:
corecrt_wstring.h:201
L
#define L(x)
Definition:
resources.c:13
count
GLuint GLuint GLsizei count
Definition:
gl.h:1545
source
Definition:
pdh_main.c:174
sdk
lib
ucrt
string
wcsncpy.cpp
Generated on Thu Dec 4 2025 06:16:23 for ReactOS by
1.9.6