F´ Flight Software - C/C++ Documentation
NASA-v2.1.0
A framework for building embedded system applications to NASA flight quality standards.
StringUtils.cpp
Go to the documentation of this file.
1
#include "
StringUtils.hpp
"
2
#include <
Fw/Types/Assert.hpp
>
3
#include "string.h"
4
5
char
*
Fw::StringUtils::string_copy
(
char
* destination,
const
char
* source, U32 num) {
6
// Handle self-copy
7
if
(destination == source) {
8
return
destination;
9
}
10
11
// Copying an overlapping range is undefined
12
FW_ASSERT
(source < destination || destination + num <= source);
13
14
char
* returned = strncpy(destination, source, num);
15
destination[num - 1] =
'\0'
;
16
return
returned;
17
}
StringUtils.hpp
Assert.hpp
Fw::StringUtils::string_copy
char * string_copy(char *destination, const char *source, U32 num)
copy string with null-termination guaranteed
Definition:
StringUtils.cpp:5
FW_ASSERT
#define FW_ASSERT(...)
Definition:
Assert.hpp:9
Fw
Types
StringUtils.cpp
Generated by
1.8.17