String conversion to numeric value functions.
#include <math.h> #include <stdlib.h> double atof(const char *string); int atoi(const char *string); long atol(const char *string);
long long atoll(const char *string);
#include <wchar.h>
double _wtof(const wchar_t *string);
int _wtoi(const wchar_t *string);
long _wtol(const wchar_t *string);
long long _wtoll(const wchar_t *string);
string
These functions stop reading the input string at the first character not recognizable as part of a number. This character may be the null character \0 terminating the string.
atof
(and _wtof) expects the string to have this form:
[whitespace][sign]{[digits]|[.digits]}[d|D|e|E[sign]digits]
Where:
whitespace
sign
digits
atoi
, atol
and atoll
(and their wide-character equivalents) do not recognize decimal points or exponents. The string argument for these functions has this form:
[whitespace][sign][digits]
Where whitespace, sign, and digits are as described for atof.
Note: Results are undefined on overflow.
The converted value. If the input cannot be converted to a value of the specified type:
0 |
atoi, _wtoi |
0L |
atol, _wtol |
0LL | atoll, _wtoll |
0.0 |
atof, _wtof |
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
---|---|---|
_ttof, _tstof | atof | _wtof |
_tstoi, _tstoi | atoi | _wtoi |
_tstol | atol | _wtol |
_ttoll, _tstoll | atoll | _wtoll |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 (for wide-character and generic text versions) |
intime/rt/include/stdlib.h intime/rt/include/wchar.h intime/rt/include/tchar.h |
math.h stdlib.h wchar.h tchar.h |
clib.lib |