C Tutorial String.h
Standard Library Functions
stdio.h
ctype.h
string.h

stdlib.h
 

 

HOME
 


 

None of these string routines allocate memory or check that the passed in memory is the

right size. The caller is responsible for making sure there is "enough" memory for the

operation. The type size_t is an unsigned integer wide enough for the computer's address space -- most likely an unsigned long.

 

size_t strlen(const char* string);

Return the number of chars in a C string. EG strlen("abc")==3

 

char* strcpy(char* dest, const char* source);

Copy the characters from the source string to the destination string.

 

size_t strlcpy(char* dest, const char* source, size_t dest_size);

Like strcpy(), but knows the size of the dest. Truncates if necessary. Use this to avoid memory errors and buffer-overflow security problems. This function is not as

standard as strcpy(), but most sytems have it. Do not use the old strncpy() function --

it is difficult to use correctly.

 

char *strcat(char* dest, const char* source);

Append the characters from the source string to the end of destination string. (There is

a non-standard strlcat() variant that takes the size of the dest as third argument.)

 

int strcmp(const char* a, const char* b);

Compare two strings and return an int which encodes their ordering. zero:a==b,

negative:a<b,  positive:a>b. It is a common error to think of the result of strcmp() as

being boolean true if the strings are equal which is, unfortunately, exactly backwards.

 

char* strchr(const char* searchIn, char ch);

Search the given string for the first occurence of the given character. Returns a

pointer to the character, or NULL if none is found.

 

char* strstr(const char* searchIn, const char* searchFor); Similar to strchr(), but searches for an entire string instead of a single character. The search is case sensitive.

 

void* memcpy(void* dest, const void* source, size_t n);

Copy the given number of bytes from the source to the destination. The source and

destination must not overlap. This may be implemented in a specialized but highly

optimized way for a particular computer.

 

void* memmove(void* dest, const void* source, size_t n); Similar to memcpy() but allows the areas to overlap. This probably runs slightly slower than memcpy().

Want To Know more with

Video ???

Contact for more learning: webmaster@freehost7com