C 지역화 함수

위키백과, 우리 모두의 백과사전.
(Locale.h에서 넘어옴)

컴퓨팅에서 C 지역화 함수는 기본적인 지역화 루틴을 구현한 C 프로그래밍 언어내 함수 모음이다.[1][2] 이 기능은 다국어 프로그램에서 사용되어 특정 로케일에 조정된다. 특히, 숫자나 통화를 표시하는 방법을 수정하는 데 쓰인다. 이 설정은 C 표준 라이브러리 내 입출력 함수의 동작에 영향을 준다.

예시[편집]

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

int main(void)
{
    /* Locale is set to "C" before this. This call sets it
       to the "current locale" by reading environment variables: */
    setlocale(LC_ALL, "");

    const struct lconv * const currentlocale = localeconv();

    printf("In the current locale, the default currency symbol is: %s\n",
        currentlocale->currency_symbol);

    return EXIT_SUCCESS;
}

같이 보기[편집]

참조[편집]

  1. 《ISO/IEC 9899:1999 specification》 (PDF). p. 204, § 7.11 Localization. 
  2. Prata, Stephen (2004). 《C primer plus》. Sams Publishing. Appendix B, Section V: The Standard ANSI C Library with C99 Additions. ISBN 0-672-32696-5.