Share via


_atoi64, _atoi64_l, _wtoi64, _wtoi64_l

문자열을 64 비트 정수로 변환합니다.

__int64 _atoi64(
   const char *str 
);
__int64 _wtoi64(
   const wchar_t *str 
);
__int64 _atoi64_l(
   const char *str,
   _locale_t locale
);
__int64 _wtoi64_l(
   const wchar_t *str,
   _locale_t locale
);

매개 변수

  • str
    변환 될 문자열입니다.

  • locale
    사용 하는 로캘.

반환 값

각 함수는 반환의 __int64 값에서 입력된 문자를 숫자로 해석 하 여 생성 합니다.반환 값 0에 대 한입니다 _atoi64 는 입력 값을 해당 형식으로 변환할 수 없는 경우.

큰 양수 정수 계열 값을 오버플로 경우에 _atoi64 반환 I64_MAX 및 I64_MIN 의 큰 음의 정수 계열 값을 오버플로 합니다.

모든 범위를 벗어난 경우에 errno 로 설정 된 ERANGE.매개 변수가 전달 된 경우 NULL, 설명에 따라 잘못 된 매개 변수 처리기가 호출 매개 변수 유효성 검사.실행을 계속 수 있으면 이러한 함수를 설정 errno 에 EINVAL 및 0을 반환 합니다.

설명

이러한 함수는 문자열 64 비트 정수 값으로 변환합니다.

입력된 문자열의 지정 된 형식의 숫자 값으로 해석 될 수 있는 문자 시퀀스입니다.이 함수는 숫자의 일부로 인식할 수 없는 첫 번째 문자에서 입력된 문자열을 읽는 중지 합니다.이 문자는 null 문자 ('\ 0' 또는 '\ 0' L) 될 수 있습니다 문자열을 종료 합니다.

str 인수를 _atoi64 형식은 다음과 같습니다.

[whitespace] [sign] [digits]]

A whitespace 는 무시 됩니다; 공백이 나 탭 문자 중 구성 됩니다. sign하나는 더하기 (+) 또는 빼기 (-) 및 digits 하나 이상의 숫자입니다.

_wtoi64동일 _atoi64 와이드 문자열이 매개 변수로 사용을 제외 하 고.

버전으로 이러한 함수는 _l 접미사는 현재 로캘 대신 전달 된 로캘 매개 변수를 사용할 경우를 제외 하 고 동일 합니다.자세한 내용은 로캘를 참조하십시오.

일반 텍스트 루틴 매핑

Tchar.h 루틴

_UNICODE 및 _mbcs가 정의 되지 않았습니다.

_Mbcs가 정의

_Unicode가 정의

_tstoi64

_atoi64

_atoi64

_wtoi64

_ttoi64

_atoi64

_atoi64

_wtoi64

요구 사항

루틴

필수 헤더

_atoi64, _atoi64_l

<stdlib.h>

_wtoi64, _wtoi64_l

<stdlib.h> 또는 <wchar.h>

예제

이 프로그램이 어떻게 사용 하 여 숫자 값을 문자열로 저장 된 숫자를 변환할 수 있습니다 보여 줍니다 있는 _atoi64 함수입니다.

// crt_atoi64.c
// This program shows how numbers stored as
// strings can be converted to numeric values
// using the _atoi64 functions.
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

int main( void )
{
    char    *str = NULL;
    __int64 value = 0;

    // An example of the _atoi64 function
    // with leading and trailing white spaces.
    str = "  -2309 ";
    value = _atoi64( str );
    printf( "Function: _atoi64( \"%s\" ) = %d\n", str, value );

    // Another example of the _atoi64 function 
    // with an arbitrary decimal point.
    str = "314127.64";
    value = _atoi64( str );
    printf( "Function: _atoi64( \"%s\" ) = %d\n", str, value );

    // Another example of the _atoi64 function
    // with an overflow condition occurring.
    str = "3336402735171707160320";
    value = _atoi64( str );
    printf( "Function: _atoi64( \"%s\" ) = %d\n", str, value );
    if (errno == ERANGE)
    {
       printf("Overflow condition occurred.\n");
    }
}
  

해당 .NET Framework 항목

참고 항목

참조

데이터 변환

부동 소수점 지원

로캘

_ecvt

_fcvt

_gcvt

setlocale을 _wsetlocale

_atodbl, _atodbl_l, _atoldbl, _atoldbl_l, _atoflt _atoflt_l