Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>atol() convert string to long</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 atol()                  Convert String to Long

 include <stdlib.h>

 long       atol(string);                Value of string, converted to long
 const 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
 where:

                  whitespace        any number of tab or space
                                    characters are ignored
                  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);
           }


See Also: atoi() atof() ecvt() fcvt() gcvt()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson