diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-09 08:33:08 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-09 08:33:08 +0200 |
| commit | 5d34aff5888d3f0c624251f15bedb96c347978d6 (patch) | |
| tree | 69a49651271d645ca7eaa114cb1830bf759c0930 /src/strops.cpp | |
| parent | b94a7ae06b20d550c727d5192cea8baf3e8fb641 (diff) | |
refactors
Diffstat (limited to 'src/strops.cpp')
| -rw-r--r-- | src/strops.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/strops.cpp b/src/strops.cpp new file mode 100644 index 0000000..42042cb --- /dev/null +++ b/src/strops.cpp @@ -0,0 +1,18 @@ +#include <string.h> + +#include "strops.hpp" + +size_t strops_copy(char *dst, const char *src, size_t size) +{ + size_t srclen; + size --; + srclen = strlen(src); + + if (srclen > size) + srclen = size; + + memcpy(dst, src, srclen); + dst[srclen] = '\0'; + + return (srclen); +}
\ No newline at end of file |
