> ~ Online tutorial

    <string.h>
•    string.h is the header in the C standard library for the C programming language which contains macro definitions, constants, and declarations of functions and types used not only for string handling but also various memory handling functions; the name is thus something of a misnomer.
•    Functions declared in string.h are extremely popular, since as a part of the C standard library, they are guaranteed to work on any platform which supports C. However, some security issues exist with these functions, such as buffer overflows, leading programmers to prefer safer, possibly less portable variants. Also, the string functions only work with ASCII or character sets that extend ASCII in a compatible manner such as ISO-8859-1; multibyte ASCII-compatible character sets such as UTF-8 will work with the caveat that string "length" is to be interpreted as the count of bytes in the string (rather than the count of Unicode characters) and that searches for individual characters only work effectively for ASCII characters. Non-ASCII compatible string handling is generally achieved through wchar.h.
•    Functions
Name    Notes
void *memcpy(void *dest, const void *src, size_t n);    copies n bytes between two memory areas; if there is overlap, the behavior is undefined
void *memmove(void *dest, const void *src, size_t n);    copies n bytes between two memory areas; unlike with memcpy the areas may overlap
void *memchr(const void *s, int c, size_t n);    returns a pointer to the first occurrence of c in the first n bytes of s, or NULL if not found
int memcmp(const void *s1, const void *s2, size_t n);    compares the first n bytes of two memory areas
void *memset(void *, int c, size_t n);    overwrites a memory area with n copies of c
char *strcat(char *dest, const char *src);    appends the string src to dest
char *strncat(char *dest, const char *src, size_t n);    appends at most n bytes of the string src to dest
char *strchr(const char *, int c);    locates character c in a string, searching from the beginning
char *strrchr(const char *, int c);    locates character c in a string, searching from the end
int strcmp(const char *, const char *);    compares two strings lexicographically
int strncmp(const char *, const char *, size_t n);    compares up to the first n bytes of two strings lexicographically
int strcoll(const char *, const char *);    compares two strings using the current locale's collating order

char *strcpy(char *dest, const char *src);    copies a string from one location to another
char *strncpy(char *dest, const char *src, size_t n);    write exactly n bytes to dest, copying from src or add 0's
char *strerror(int);
returns the string representation of an error number e.g. errno (not thread-safe)

size_t strlen(const char *);
finds the length of a C string

size_t strspn(const char *, const char *accept);    determines the length of the maximal initial substring consisting entirely of characters in accept
size_t strcspn(const char *, const char *reject);    determines the length of the maximal initial substring consisting entirely of characters not in reject
char *strpbrk(const char *, const char *accept);    finds the first occurrence of any character in accept
char *strstr(const char *haystack, const char *needle);    finds the first occurrence of the string "needle" in the longer string "haystack"
char *strtok(char *, const char * delim);    parses a string into a sequence of tokens; non-thread safe in the spec, non-reentrant
size_t strxfrm(char *dest, const char *src, size_t n);    transforms src into a collating form, such that the numerical sort order of the transformed string is equivalent to the collating order of src
•   

Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: