= The stdlib library = The [source:soft/giet_vm/giet_libs/stdlib.c stdlib.c] and [source:soft/giet_vm/giet_libs/stdlib.h stdlib.h] files define a set of useful functions that do not require a system call. [[PageOutline]] == 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. == unsigned int '''snprintf'''( char* string , unsigned int maxlen , char* format , va_list* args ) == This function can be directly used by an application to build a formated string. It is also used the ''giet_tty_printf()'' and ''giet_fat_printf()'' system calls. It analyse the and arguments and returns a byte stream in the buffer. The TO_STREAM macro checks buffer overflow. It returns number of written bytes in case of success. It returns 0xFFFFFFFF in case of error (illegal format, or buffer overflow).