diff options
Diffstat (limited to 'lib/joinarrays.c')
-rw-r--r-- | lib/joinarrays.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/joinarrays.c b/lib/joinarrays.c new file mode 100644 index 0000000..22070b0 --- /dev/null +++ b/lib/joinarrays.c @@ -0,0 +1,18 @@ +#pragma once +#include <bvr.h> +// do not use this, this is idiotic, use strlcpy +char * join_null_terminated_arrays(char * a1, char * a2) { // returns null terminated array + char sizeof0 = BVR_VALUE_CHUNK_SIZE; + char * a0 = malloc(sizeof(char) * sizeof0); + char i = 0; + char position = 0; + while(a1[i] != 0) { + a0[position++] = a1[i++]; + } + i = 0; + while(a2[i] != 0) { + a0[position++] = a2[i++]; + } + a0[position++] = 0; + return a0; +} |