Wednesday, August 31, 2016

C Library Header – string

The <string.h> header provides many functions useful for manipulating strings (character arrays).

The <string.h> header shall define the following macros:
NULLNull pointer

The <string.h> header shall define the following function:
String manipulation:
strcpy
strcpy_s(C11)
copies one string to another
strncpy
strncpy_s(C11)
copies a certain amount of characters from one string to another
strcat
strcat_s(C11)
concatenates two strings
strncat
strncat_s(C11)
concatenates a certain amount of characters of two strings
strxfrmtransform a string so that strcmp would produce the same result as strcoll

String examination:
strlen
strnlen_s(C11)
returns the length of a given string
strcmpcompares two strings
strncmpcompares a certain amount of characters of two strings
strcollcompares two strings in accordance to the current locale
strchrfinds the first occurrence of a character
strrchrfinds the last occurrence of a character
strspnreturns the length of the maximum initial segment that consists of only the characters found in another byte string
strcspnreturns the length of the maximum initial segment that consists of only the characters not found in another byte string
strpbrkfinds the first location of any character in one string, in another string
strstrfinds the first occurrence of a substring of characters
strtok
strtok_s(C11)
finds the next token in a byte string

Memory manipulation:
memchrsearches an array for the first occurrence of a character
memcmpcompares two buffers
memset
memset_s(C11)
fills a buffer with a character
memcpy
memcpy_s(C11)
copies one buffer to another
memmove
memmove_s(C11)
moves one buffer to another

Miscellaneous:
strerror
strerror_s(C11)
strerrorlen_s(C11)
returns a text version of a given error code

The <string.h> header shall define the following type:
size_t Unsigned integral type



Related topics:
<setdef.h>   |   <stdint.h>   |   <stdio.h>   |   <stdlib.h>   |   <stdnoreturn.h>   |   Standard Library in C

List of topics: C Programming

No comments:

Post a Comment