|
|
|
|
|
by gengkev
2342 days ago
|
|
This isn't even quite right, since the first argument of strncat needs to be a null-terminated string, and strncpy may not null-terminate. I would honestly just give up and write size_t len = strlen(source);
char *dest = malloc(len + sizeof("@example.com")-1 + 1);
strcpy(dest, source);
strcpy(dest + len, "@example.com");
|
|