wiki:library_stdlib

Version 5 (modified by alain, 9 years ago) (diff)

--

The stdlib library

The stdlib.c and stdlib.h files define a set of useful functions that do not require a system call.

int atoi( char * string )

This function translate a character string to a signed integer. All characters (but the first) must be digits. For a negative value, the first character must be the '-' (minus) character.

double atof( char * string )

This function translate a character string to a double. Conversion stop at first non-numeric character (except a first '+' or '-' and one '.').

void* memcpy( void* dst, const void* src, unsigned int size )

This function copies size bytes from the src source buffer to the dst destination buffer.

void* memset( void* dst , int s , unsigned int size )

This function initializes size bytes in the dst destination buffer, with the value defined by (char)s.

unsigned int strlen( char* string )

This function returns the number of characters in a string. The terminating NUL character is not taken into account.

  • unsigned int strcmp( char* s1 , char* s2 ) ==

This function compare the two s1 & s2 strings.It returns 0 if strings are identical (including the terminating NUL character), and returns 1 if they are not.

unsigned int strcpy( char* dest , char* source )

This function copies the source string to the dest string.It returns a pointer on the dest string.