Name
      
      nl_langinfo - query language and locale information 
      
      
      
      
         
         Library
      
      
      
      
      libc.lib
      
      
      
      
         
         Synopsis
      
      
      
      
      
      
      
         
            |  | char *
               
               
               nl_langinfo (nl_item item); 
 | 
      
      
         
         Return values
      
      
      In a locale where langinfo data is not defined,
      
      
       nl_langinfo
      returns a pointer to the corresponding string in the
      
      
       POSIX
      locale.
      In all locales,
      
      
       nl_langinfo
      returns a pointer to an empty string if
      
      
       item
      contains an invalid setting.
      
      
      "Dom"
      if the identified language was
      Portuguese, and
      
      
      "Sun"
      if the identified language was English.
      
      
      
      
         
         Detailed description
      
      
      The
      
      
       nl_langinfo
      function returns a pointer to a string containing information relevant to
      the particular language or cultural area defined in the program’s locale.
      The manifest constant names and values of
      
      
       item
      are defined in
      
      
      
      
         
            |  |  #include <langinfo.h>
                  YESEXPR, NOEXPR, YESSTR, NOSTR items are not supported since LC_MESSAGE category is not supported.
                  
                  
                  
                
                  
                  
                   item
                  passed to
                  
                  
                   nl_langinfo
                  can be any value listed below.
                  
                  
                  
                  
                  
                   
                     
                        | CODESET |  
                        |  | Name of the character encoding used in the locale. |  
                        | D_T_FMT |  
                        |  | String for formatting date and time |  
                        | D_FMT | Date format string |  
                        | T_FMT | Time format string |  
                        | T_FMT_AMPM |  
                        |  | AM or PM time formatting string |  
                        | AM_STR |  
                        |  | Ante Meridian affix |  
                        | PM_STR |  
                        |  | Post Meridian affix |  
                        | ABDAY_1 - ABDAY_7 |  
                        |  | Abbreviated name of the nth day of the week |  
                        | DAY_1 - DAY_7 |  
                        |  | Name of the nth day of the week |  
                        | MON_1 - MON_12 |  
                        |  | Name of the nth month of the year |  
                        | ABMON_1 - ABMON_12 |  
                        |  | Name of the nth month of the year |  
                        | RADIXCHAR |  
                        |  | Radix character i.e character used to separate decimal value |  
                        | THOUSEP |  
                        |  | Separator for thousands |  |
 | 
      
      
         
         Examples
      
      
      
      
      #include<stdio.h>
#include<locale.h>
#include<langinfo.h>
int main()
{
        //Set the locale to Finnish
        char* locale = setlocale(LC_ALL,"fi_FI.ISO-8859-1");
        char* str = NULL;
        //Check whether locale setting is succesfull or not
        if(NULL != locale)
        {
             printf("Locale setting is successful\n");
             printf("Locale is set to %s\n", locale);
             //Retrieve first day of the week
             str = nl_langinfo(DAY_1);
             if(NULL != str)
             {
                  printf("First day of the week is %s\n", str);
             }
             //Retrieve second month of the year
             str = nl_langinfo(MON_2);
             if(NULL != str)
             {
                  printf("Second month of the year is %s\n", str);
             }
        }
        else
        {
                printf("Locale setting failed\n");
        }
        return 0;
}
         
      
      
      
      
         Output
         
         
         
      
Locale setting is successful
Locale is set to fi_FI.ISO-8859-1
First day of the week is sunnuntai
Second month of the year is helmikuu
         
      
         
         See also
      
      
      
      
      setlocale
      
      
      Feedback
For additional information or queries on this page send feedback	
      
      
         
         
         
            
               | © 2005-2007 Nokia  | 
 |