ATOLONG C-3

NAME

atolong - convert ASCII to LONG value

SYNOPSIS

#include <cbase/dtypes.h>

LONG atolong (sptr)

char *sptr;

DESCRIPTION

This function converts a string pointed to by sptr to a LONG value. Atolong first tries to convert sptr with the format returned by getfint(C-3). If this fails, atolong applies a set of standard input rules.

The standard input rules allow an optional string of tabs and spaces, then an optional minus sign, then a string of digits. The string may also contain one or more of the thousands separator character (returned by getfthou(C-3)) to make the number more readable.

Atolong returns the equivalent long integer value. The advantages of using atolong over atol(3) is that atolong understands special formats and special characters for any defined country, and it accepts a number containing embedded thousands separator characters (commas for U.S.A. formats).

For atolong, the first unrecognized character ends the string.

SEE ALSO

fcountry(C-3), getfint(C-3), getfthou(C-3), fatolong(C-3), atol(C-3)

C/Base Reference Manual Chapter 13, "Formatting Data Values"

NOTES

On overflow or other formatting errors, atolong returns 0.