Pages

Wednesday, 8 June 2011

Function Description



Function Description
char *strcat(char *str1, const char *str2) Concatenates the string pointed to by str2 to the end of
the string pointed to by str1. Returns str1. If the strings
overlap, the behavior of strcat( ) is undefined.
char *strchr(const char *str, int ch) Returns a pointer to the first occurrence of the low-order
byte of ch in the string pointed to by str. If no match is
found, a null pointer is returned.
int strcmp(const char *str1, const char str2) Lexicographically compares the string pointed to by str1
with the string pointed to by str2. Returns less than zero
if str1 is less than str2, greater than zero if str1 is greater
than str2, and zero if the two strings are the same.
10 H e r b S c h i l d t ' s C + + P r o g r a m m i n g C o o k b o o k
Function Description
char *strcpy(char *target,
const char *source)
Copies the string pointed to by source to the string pointed
to by target. Returns target. If the strings overlap, the
behavior of strcpy( ) is undefined.
size_t strcspn(const char *str1,
const char *str2)
Returns the index of the first character in the string
pointed to by str1 that matches any character in the string
pointed to by str2. If no match is found, the length of str1
is returned.
size_t strlen(const char *str) Returns the number of characters in the string pointed to
by str. The null terminator is not counted.
char *strncat(char *str1,
const char *str2,
size_t count)
Concatenates not more than count characters from
the string pointed to by str2 to the end of str1. Returns
str1. If the strings overlap, the behavior of strncat( ) is
undefined.
int strncmp(const char *str1,
const char *str2,
size_t count)
Lexicographically compares not more than the first count
characters in the string pointed to by str1 with the string
pointed to by str2. Returns less than zero if str1 is less
than str2, greater than zero if str1 is greater than str2, and
zero if the two strings are the same.
char *strncpy(char *target,
const char *source,
size_t count)
Copies not more than count characters from the string
pointed to by source to the string pointed to by target.
If source contains less than count characters, null
characters will be appended to the end of target until
count characters have been copied. However, if source is
longer than count characters, the resultant string will not
be null-terminated. Returns target. If the strings overlap,
the behavior of strcnpy( ) is undefined.
char *strpbrk(const char *str1,
const char *str2)
Returns a pointer to the first character in the string
pointed to by str1 that matches any character in the string
pointed to by str2. If no match is found, a null pointer is
returned.
char *strrchr(const char *str, int ch) Returns a pointer to the last occurrence of the low-order
byte of ch in the string pointed to by str. If no match is
found, a null pointer is returned.
size_t strspn(const char *str1,
const char *str2)
Returns the index of the first character in the string
pointed to by str1 that does not match any of the
characters in the string pointed to by str2.
char *strstr(const char *str1,
const char *str2)
Returns a pointer to the first occurrence of the string
pointed to by str2 in the string pointed to by str1. If no
match is found, a null pointer is returned.
char *strtok(char *str, const char *delims) Returns a pointer to the next token in the string pointed
to by str. The characters in the string pointed to by delims
specify the delimiters that determine the boundaries of a
token. A null pointer is returned when there is no token to
return. To tokenize a string, the first call to strtok( ) must
have str point to the string to be tokenized. Subsequent
calls must pass a null pointer to str.

0 comments:

Post a Comment

Search This Blog