Embedded Artistry Framework
Embedded Systems C++ Framework
Functions
atol.c File Reference
#include <ctype.h>
#include <stdbool.h>
#include <stdlib.h>
Include dependency graph for atol.c:

Functions

long atol (const char *str)
 Interprets a Long value in a byte string pointed to by str. More...
 

Function Documentation

◆ atol()

long atol ( const char *  str)

Interprets a Long value in a byte string pointed to by str.

Interprets a Long value in a byte string pointed to by str. Discards any whitespace characters until the first non-whitespace character is found, then takes as many characters as possible to form a valid long number representation and converts them to an long value. The valid Long value consists of the following parts: a) (optional) plus or minus sign b) numeric digits

Parameters
strpointer to the null-terminated byte string to be interpreted
Returns
long value corresponding to the contents of str on success. If the converted value falls out of range of corresponding return type, the return value is undefined. If no conversion can be performed, ​0​ is returned.

References isdigit(), and isspace().

Referenced by atol_test().

Here is the caller graph for this function: