| 
atol
 long atol ( const char * string );  | stdlib.h | 
| cplusplus.com | 
 Convert string to long.
 
Parses string interpreting its content as a number and returns a long value.
Parameters.
 Return Value.
 
The converted long integer value of the input string.
 
On overflow the result is undefined.
 
If an error occurs 0 is returned.
 Portability.
 
Defined in ANSI-C.
 Example.
/* atol example */
#include <stdio.h>
#include <stdlib.h>
main ()
{
  int i;
  char szInput [256];
  printf ("Enter a long number: ");
  gets ( szInput );
  i = atol (szInput);
  printf ("Value entered is %d, and its double %d",i,i*2);
  return 0;
}
Output:
Enter a long number: 567283
Value entered is 567283, and its double 1134566
 See also.
 
atoi,
atof,
ecvt,
fcvt,
gcvt,
strtod