{{keywords>wiki library source code example reference}}
====== atol ======
#include
long int atol(const char *str);
convert a string to long integer
===== C Sourcecode Example =====
#include /* including standard library */
//#include /* uncomment this for Windows */
#include
int main(void){
char string[]="1234";
long int i;
printf("string = %s \n", string );
printf("int = %li \n", atol(string) );
i = atol(string);
i = i + i;
printf("i + i = %li\n", i);
return 0;
}
==== Output ====
Output:
user@host:~$ ./atol
string = 1234
int = 1234
i + i = 2468