Append the contents of a char*-string to another char*-string, the contents of s2 will be appended to s1.
Append the contents of a char*-string to another char*-string, the contents of s2 will be appended to s1. Only a specified maximum number of characters are copied. The concluding 0 is automatically appended to the end of the string. The target string s1 must be long enough to accommodate the second string s2.
Name | Type | Default | Description |
Return | Pointer to the target string s1 | ||
s1 | char* | - | Target string |
s2 | char* | - | Original string |
len | int | - | Maximum number of characters \to be copied |
The example appends the contents of a string, up to 3 characters, to the string s1.
int main() { char * s1 = alloc(256);
strcpy(s1, "con"); strncat(s1, "catenate", 3);
// s1 = "concat" showmessage(s1);
release(s1);
return 0; }
Alphabetic index HTML hierarchy of classes or Java