ReactOS
0.4.16-dev-1946-g52006dd
strncpy.c
Go to the documentation of this file.
1
/***
2
*strncpy.c - copy at most n characters of string
3
*
4
* Copyright (c) Microsoft Corporation. All rights reserved.
5
*
6
*Purpose:
7
* defines strncpy() - copy at most n characters of string
8
*
9
*******************************************************************************/
10
11
#include <string.h>
12
13
#if defined _M_ARM
14
#pragma function(strncpy)
15
#endif
16
17
/***
18
*char *strncpy(dest, source, count) - copy at most n characters
19
*
20
*Purpose:
21
* Copies count characters from the source string to the
22
* destination. If count is less than the length of source,
23
* NO NULL CHARACTER is put onto the end of the copied string.
24
* If count is greater than the length of sources, dest is padded
25
* with null characters to length count.
26
*
27
*
28
*Entry:
29
* char *dest - pointer to destination
30
* char *source - source string for copy
31
* unsigned count - max number of characters to copy
32
*
33
*Exit:
34
* returns dest
35
*
36
*Exceptions:
37
*
38
*******************************************************************************/
39
40
char
*
__cdecl
strncpy
(
41
char
*
dest
,
42
const
char
*
source
,
43
size_t
count
44
)
45
{
46
char
*
start
=
dest
;
47
48
while
(
count
&& (*
dest
++ = *
source
++) !=
'\0'
)
/* copy string */
49
count
--;
50
51
if
(
count
)
/* pad out with zeroes */
52
while
(--
count
)
53
*
dest
++ =
'\0'
;
54
55
return
(
start
);
56
}
__cdecl
#define __cdecl
Definition:
accygwin.h:79
start
GLuint start
Definition:
gl.h:1545
count
GLuint GLuint GLsizei count
Definition:
gl.h:1545
dest
static char * dest
Definition:
rtl.c:135
strncpy
strncpy
Definition:
string.h:335
source
Definition:
pdh_main.c:174
sdk
lib
ucrt
string
strncpy.c
Generated on Thu Dec 4 2025 06:16:23 for ReactOS by
1.9.6