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


C Reference function realloc()

The function realloc() reallocates a memory block with a specific new size. If you call realloc() the size of the memory block pointed to by the pointer is changed to the given size in bytes. This way you are able to expand and reduce the amount of memory you want to use (if available of course.)

It is possible that the function moves the memory block to a new location, in which way the function will return this new location. If the size of the requested block is larger then the previous block then the value of the new portion is indeterminate.

If the pointer is NULL then the function will behave exactly like the function malloc(). It will assign a new block of a size in bytes and will return a pointer to it.

If the size is 0 then the memory that was previously allocated is freed as if a call of the function free() was given. It will return a NULL pointer in that case. More »


Posted in C Reference stdlib.h Functions | 6 Comments


C Reference function malloc()

The function malloc() will allocate a block of memory that is size bytes large. If the requested memory can be allocated a pointer is returned to the beginning of the memory block.

Note: the content of the received block of memory is not initialized.

Usage of malloc():

More »


Posted in C Reference stdlib.h Functions | 5 Comments


C Reference function strtol()

This function of stdlib will convert a string to long integer.

Usage of strtol():

long int strtol ( const char * str, char ** endptr, int base );

Parameters:

C string str interpreting its content as an integral number of the specified base, which is returned as a long int value. If endptr is not a null pointer, the function also sets the value pointed by endptr to point to the first character after the number. White-spaces are discarded until the first non-whitespace character is found. More »


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


C Reference function strtoul()

This function of stdlib will convert a string to an unsigned long integer.

Usage of strtoul():

unsigned long int strtoul ( const char * str, char ** endptr, int base );

Parameters:

C string str interpreting its content as an unsigned integral number of the specified base, which is returned as an unsigned long int value. More »


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