SYNOPSIS
       #include 

       char *strcat(char *dest, const char *src);

       char *strncat(char *dest, const char *src, size_t n);
DESCRIPTION
strcat appends src to dest, dropping any trailing null character in dest. It is a str function.

strncat is identical in functionality, except that it only appends the first n characters of src

Both functions return a pointer to dest.

NOTES
At times like this, I realize how much I like.. hmm... essentially all other languages than C. After all, in just about all other languages (PHP, JS, basic, PERL, etc.) you can just say "string" + "foo" to get "stringfoo". But noooo, in C, you get to handle the memory yourself. Yeehaw.

The uses for this function are both multifarious and fairly obvious, so I will not elaborate. In cases where you don't want to get a buffer overflow, you'd best use strncat (and set n intelligently).

Log in or register to write something here or to contact authors.