tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strncpy.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4
#
ifndef
TETL_CSTRING_STRNCPY_HPP
5
#
define
TETL_CSTRING_STRNCPY_HPP
6
7
#
include
<
etl
/
_contracts
/
check
.
hpp
>
8
#
include
<
etl
/
_cstddef
/
size_t
.
hpp
>
9
#
include
<
etl
/
_strings
/
cstr
.
hpp
>
10
11
namespace
etl
{
12
13
/// Copies at most count characters of the byte string pointed to by src
14
/// (including the terminating null character) to character array pointed to by
15
/// dest.
16
///
17
/// If count is reached before the entire string src was copied, the
18
/// resulting character array is not null-terminated. If, after copying the
19
/// terminating null character from src, count is not reached, additional null
20
/// characters are written to dest until the total of count characters have
21
/// been written. If the strings overlap, the behavior is undefined.
22
///
23
/// \returns dest
24
/// \ingroup cstring
25
constexpr
auto
strncpy
(
char
* dest,
char
const
* src,
etl
::size_t
const
count) ->
char
*
26
{
27
TETL_PRECONDITION(dest !=
nullptr
);
28
TETL_PRECONDITION(src !=
nullptr
);
29
return
etl
::detail::strncpy(dest, src, count);
30
}
31
32
}
// namespace etl
33
34
#
endif
// TETL_CSTRING_STRNCPY_HPP
etl::strncpy
constexpr auto strncpy(char *dest, char const *src, etl::size_t const count) -> char *
Copies at most count characters of the byte string pointed to by src (including the terminating null ...
Definition
strncpy.hpp:25
etl
Definition
adjacent_find.hpp:9
include
etl
_cstring
strncpy.hpp
Generated on Sun Sep 7 2025 19:14:54 for tetl by
1.9.8