#include #include #include int main(void) { char *buf; char *s1 = "01234567890"; char *s2 = "abcdefghijklmnopqrstuvwxyz"; int len; buf = malloc(5); if (buf == NULL) { perror("malloc"); exit(1); } len = strlcpy(buf, s1, 5); printf("cpy 5: src(%s) len(%d) dst(%s) len(%ld)\n", s1, len, buf, strlen(buf)); buf = malloc(20); if (buf == NULL) { perror("malloc"); exit(1); } len = strlcat(buf, s2, 20); printf("cat 20: src(%s) len(%d) dst(%s) len(%ld)\n", s2, len, buf, strlen(buf)); free(buf); return 0; }