how do you concatenate a string with 0 bytes ('\0') in them? i tried to write a while loop but it doesn't work either. i don't know maybe i just did something wrong. here is my code:
i set str1 to the char array i want to add to, str2 to the string i want to add, a to the amount of characters i want to add, and offset to the position in str1 i want to start adding str2 at.Code:void stradd(char str1[], char str2[], int a, int offset) { int i = 0; while (i < a) { str1[offset + i] = str2[i]; i++; } }
is there anything wrong with this code or am i just somehow doing something wrong?