blob: 570ecc790c1451d2ad798873cfcd67e7e01689ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#ifndef CHAR_ARRAY_HELPERS_HPP
#define CHAR_ARRAY_HELPERS_HPP
#include <cstring>
#include <iostream>
#define MAX_CHAR 100
inline bool OverwriteCharArray(char* dest, const char* source, size_t size = MAX_CHAR)
{
size_t newLength = strlen(source);
if (newLength >= size)
{
std::cerr << "Error: Buffer size exceeded.\n";
return false;
}
memset(dest, 0, size);
strcpy(dest, source);
return true;
}
#endif
|