strncat. McGraw-Hill The Complete Reference Fourth Edition
ಜಾಹಿರಾತು
ಜಾಹಿರಾತು
732
C + + : T h e C o m p l e t e R e f e r e n c e
Related functions are memcpy( ), strchr( ), strcmp( ), and strncmp( ).
strncat
#include <cstring> char *strncat(char * str1, const char *str2, size_t count);
The strncat( ) function concatenates not more than count characters of the string pointed to by str2 to the string pointed to by str1 and terminates str1 with a null. The null terminator originally ending str1 is overwritten by the first character of str2.
The string str2 is untouched by the operation. If the strings overlap, the behavior is undefined.
The strncat( ) function returns str1.
Remember that no bounds checking takes place, so it is the programmer's responsibility to ensure that str1 is large enough to hold both its original contents and also those of str2.
Related functions are strcat( ), strnchr( ), strncmp( ), and strncpy( ).
strncmp
#include <cstring> int strncmp(const char * str1, const char *str2, size_t count);
The strncmp( ) function lexicographically compares not more than count characters from the two null-terminated strings and returns an integer based on the outcome, as shown here:
Value
Less than zero
Zero
Greater than zero
Meaning
str1 is less than str2.
str1 is equal to str2.
str1 is greater than str2.
If there are less than count characters in either string, the comparison ends when the first null is encountered.
Related functions are strcmp( ), strnchr( ), and strncpy( ).
ಡೌನ್ಲೋಡ್ ಮಾಡಿ
ಜಾಹಿರಾತು