Copy the contents of a char*-string into another, the contents of s2 will be copied into s1.
Copy the contents of a char*-string into another, the contents of s2 will be copied into 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 that are to be copied. The values doesn#t reflect the number of available byzes but the maximum length of the result. |
The example appends the contents of a string, the length of which can vary to a maximum of 4 characters, to the string s1.
char s1[5]; char * s2 = alloc (1000);
...s2 will be loaded
strncat (s1, s2, 4);
Alphabetic index HTML hierarchy of classes or Java