INtime SDK Help
atof, atoi, atol, atoll, _wtof, _wtoi, _wtol, _wtoll

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);

Parameters

string
A sequence of characters that represent a numerical value of the specified type. The maximum string size for atof and _watof is 100 characters.

Remarks

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
Space and/or tab characters, which are ignored.
sign
Either plus (+) or minus (-).
digits
Decimal digits. If no digits appear before the decimal point, at least one must appear after it. There may be an exponent, which is an introductory letter (d, D, e, or E) and an optionally signed integer.

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.

Return Values

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

Generic Text Routines

tchar.h routine _UNICODE not defined _UNICODE defined
_ttof, _tstof atof _wtof
_tstoi, _tstoi atoi _wtoi
_tstol atol _wtol
_ttoll, _tstoll atoll _wtoll

Requirements

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
See Also