_atoi64, _wtoi64

De RAD Studio
Aller à : navigation, rechercher

Remonter à stdlib.h - Index


Header File

stdlib.h

Category

Conversion Routines, Math Routines

Prototype

__int64 _atoi64(const char *s);
__int64 _wtoi64(const wchar_t *s);

Description

Converts a string to an __int64.

The syntax of the string must be:

__int64 ::= [isspace]* [sign] digit [digit]*

Only decimal integers are acceptable.

_wtoi64 is the wide-character version. It converts a wide-character string to an __int64.

In this function, the first unrecognized character ends the conversion. There are no provisions for overflow in atoi (results are undefined). There is no defined method to return an error indication to the caller. The result is undefined if the input string is invalid.

Return Value

Returns the converted value of the input string. If the string cannot be converted to a __int64, the return value is 0.

Example

#include <stdlib.h>
#include <math.h>
__int64 add_inputs(wchar_t* left, wchar_t* right)
{
  /* Transform the input strings into __int64 */
  __int64 d_left = _wtoi64(left);
  __int64 d_right = _wtoi64(right);

  /* Add the transformed __int64 values */
  return d_left + d_right;
}

Portability

POSIX Win32 ANSI C ANSI C++

_atoi64

+

_wtoi64

+