C Reference function mblen()

The function mlen() of the library stdlib.h is used to get the length of a multi-byte character.

Usage of mblen():

int mblen ( const char * pmb, size_t max );

The pmb (pointer multibyte character) pointer is pointing to the multi-byte value where you want to know the size of. It will only examine at most max bytes.

Parameters:

More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function mblen()


C Reference function mbtowc()

The function mbtowc(), that is part of the stdlib.h library, is used to convert a multi-byte character to wide character.

Usage of mbtowc():

int mbtowc ( wchar_t * pwc, const char * pmb, size_t max );

The multibyte character pointed by pmb (pointer multibyte character) is converted to a wide character which is stored at the location that is pointed by pwc (pointer wide character). The length in bytes of the multiby character is returned. More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function mbtowc()


C Reference function qsort()

The function qsort() of the stdlib.h is used to sort the elements of an array.

Usage of qsort():

void qsort ( void * base, size_t num, size_t size, int ( * comparator ) ( const void *, const void * ) );

The function qsort() sorts the num element of the array pointed by base. Every element has a size of size bytes long. The qsort function will use the comparator function to determine the order of the elements.

The function will not return a value. The content is modified in the newly sorted order.

Parameters:

More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function qsort()


C Reference function bsearch()

The function bsearch() of the stdlib.h is used to do a binary search in an array.

Usage of bsearch():

void * bsearch ( const void * key, const void * base, size_t num, size_t size, int ( * comparator ) ( const void *, const void * ) );

It is searching for a given key in the array that is pointed to by base. Base is formed by the number of elements (num). Each element has a size of size bytes. The function will return a void* pointer to the first element that is matching the search key. The function compares each element to the key by calling the comparator. More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function bsearch()


C Reference function getenv()

The function getenv() of the stdlib.h will get the environment string.

Usage of getenv():

char * getenv ( const char * name );

The function will retrieve a C string that is containing a value of the environment variable, which is specified with the name argument.

Parameters:

The name of the variable that you want to get.

Return value:

More »


Posted in C Reference stdlib.h Functions | 4 Comments


C Reference function exit()

The function exit() will terminate the process that calls the exit.

Usage of exit():

void exit ( int status );

On call the process will terminate normally. It will perform regular cleanup as normal for a normal ending process. (For example atexit functions are executed.)

Parameters:

A status value returned to the parent process.

Return value:

More »


Posted in C Reference stdlib.h Functions | 1 Comment


C Reference function atexit()

With the function atexit() it is possible to set a function that will be executed on termination of the program.

Usage of atexit():

int atexit ( void ( * func ) (void) );

If the program is terminated normally then the function pointed by the func pointer argument is called.
If there are more then one atexit functions (multiple calls) then they are all executed in reverse order as the where stacked. More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function atexit()


C Reference function abort()

This function of stdlib will abort the current process.

Usage of abort():

void abort ( void );

The function aborts the process with an abnormal program termination.
The function abort will generate a signal SIGABRT. This signal will by default causes the program to terminate.

Parameters:

More »


Posted in C Reference stdlib.h Functions | Comments Off on C Reference function abort()


C Reference function system()

The function system() will invoke the command processor to execute a command. If the command execution is terminated the processor will give the control back to the program that has called the system command.

Usage of system():

int system ( const char * command );

It will return an integer value, which is interpretation is different on various systems, thus system dependent.
If you want to check whether there is a command processor exist then you use the NULL argument in the function. More »


Posted in C Reference stdlib.h Functions | 2 Comments


C Reference function calloc()

The function calloc() will allocate a block of memory for an array. All of these elements are size bytes long. During the initialization all bits are set to zero.

Usage of calloc():

void * calloc ( size_t num, size_t size );

Parameters:

Number of elements (array) to allocate and the size of elements.

Return value:

More »


Posted in C Reference stdlib.h Functions | 8 Comments