Monday, October 31, 2016

C Library Function – string

The <string.h> header shall define the following function(s).

Copying Functions:
memcpy void* memcpy( void *dest, const void *src, size_t count );
memcpy_s(C11) errno_t memcpy_s( void *restrict dest, rsize_t destsz, const void *restrict src, rsize_t count );
memmove void* memmove( void* dest, const void* src, size_t count );
memmove_s(C11) errno_t memmove_s(void *dest, rsize_t destsz, const void *src, rsize_t count);
strcpy char *strcpy( char *dest, const char *src );
strcpy_s(C11) errno_t strcpy_s(char *restrict dest, rsize_t destsz, const char *restrict src);
strncpy char *strncpy( char *dest, const char *src, size_t count );
strncpy_s(C11) errno_t strncpy_s(char *restrict dest, rsize_t destsz, const char *restrict src, rsize_t count);

Concatenation Functions:
strcat char *strcat( char *dest, const char *src );
strcat_s(C11) errno_t strcat_s(char *restrict dest, rsize_t destsz, const char *restrict src);
strncat char *strncat( char *dest, const char *src, size_t count );
strncat_s(C11) errno_t strncat_s(char *restrict dest, rsize_t destsz, const char *restrict src, rsize_t count);

Comparison Functions:
memcmp int memcmp( const void* lhs, const void* rhs, size_t count );
strcmp int strcmp( const char *lhs, const char *rhs );
strncmp int strncmp( const char *lhs, const char *rhs, size_t count );
strcoll int strcoll( const char *lhs, const char *rhs );
strxfrm size_t strxfrm( char *dest, const char *src, size_t count );

Search Functions:
memchr void* memchr( const void* ptr, int ch, size_t count );
strchr char *strchr( const char *str, int ch );
strcspn size_t strcspn( const char *dest, const char *src );
strpbrk char* strpbrk( const char* dest, const char* breakset );
strrchr char *strrchr( const char *str, int ch );
strspn size_t strspn( const char *dest, const char *src );
strstr char *strstr( const char* str, const char* substr );
strtok char *strtok( char *str, const char *delim );
strtok_s(C11) char *strtok_s(char *restrict str, rsize_t *restrict strmax, const char *restrict delim, char **restrict ptr);

Miscellaneous Functions:
memset void *memset( void *dest, int ch, size_t count );
memset_s(C11) errno_t memset_s( void *dest, rsize_t destsz, int ch, rsize_t count );
strerror char* strerror( int errnum );
strerror_s(C11) errno_t strerror_s( char *buf, rsize_t bufsz, errno_t errnum );
strerrorlen_s(C11) size_t strerrorlen_s( errno_t errnum );
strlen size_t strlen( const char *str );
strnlen_s(C11) size_t strnlen_s( const char *str, size_t strsz );



Related topics:
Library Functions in C   |   Standard Library in C   |   Header Files in C   |   Functions in C   |   Keywords in C   |   Data Types in C   |   Pointers in C

List of topics: C Programming

No comments:

Post a Comment