I am doing this to append some text:
char text[100];
strcpy(text, "Hello");
char input[] = "random";
strncpy(text + strlen(text), input, sizeof(text) - strlen(text));
I did this and it seems to work fine for ASCII text. But I fear I am not being safe doing pointer arithmetic. What if the input is UTF-8?
FYI, when I do text + strlen(text)
I am getting a pointer to the end of the sentence and then appending to the end of the sentence.
i.e.
text => |h|e|l|l|o|NUL||||||....
text + strlen(text) => |NUL|||||.....