|
|
#include <stdlib.h>long int atol(const char *str);
The atol( ) function converts the string pointed to by str into a long int value. The string must contain a valid integer number. If this is not the case, the returned value is undefined.
The number can be terminated by any character that cannot be part of an integer number. This includes whitespace, punctuation, and characters. This means that if atol( ) is called with “123.23”, the long integer value 123L will be returned, and the “.23” is ignored.
Related functions are atof( ), atoi( ), and atoll( ).
|
|