atol()                   Convert String to Long
 
 
 include <stdlib.h>
 
 long       atol(string);                Value of string, converted to long
 char       *string;                     String to be converted
 
    atol() converts 'string' to a long integer value. atol() does not
    recognize decimal points or exponents.  'string' has the following
    format:
 
                 [whitespace][sign]digits
 
                 whitespace        any number of tab or space characters
                 sign              + or -
                 digits            one or more decimal digits.
 
 
    Returns:    The long value of 'string'.  If 'string' cannot be
                converted to a long value, 0 is returned. The return
                value is undefined for overflow.
 
 
  -------------------------------- Example ---------------------------------
 
    The following statements convert a string to a long value and print
    the result.
 
         #include <stdlib.h>
 
         long   l;
         char   *s;
 
         main()
         {
             s = "98765";
             l = atol(s);
             printf("%ld\n",l);
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster