Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>country() return country-dependent information</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 country()               Return Country-Dependent Information

 #include   <dos.h>

 struct     country *country(countrycode,countryp);
 int        countrycode;                 Current country
 country    *countryp;                   Pointer to country information

    country() specifies the formatting of the date, time, currency
    symbol, and other country-specific data.

    If the value of 'countryp' is -1, country() sets the current country
    to the value in 'countrycode'.  'countrycode' must be non-zero.

    If the value of 'countryp' is not -1, 'countryp' is a pointer to the
    structure 'country', which is filled with information for the current
    country, if 'countrycode' = 0, or with information for the country
    given by 'countrycode'.

    'country' includes the following elements (details for co_date and
    co_currstyle are given below):

           struct country  {
               int co_date;             /*Date format*/
               char co_curr[5];         /*Currency symbol*/
               char co_thsep[2];        /*Thousand separator*/
               char co_desep[2];        /*Decimal separator*/
               char co_dtsep[2];        /*Date separator*/
               char co_tmsep[2];        /*Time separator*/
               char co_currstyle;       /*Currency style */
               char co_digits;          /*Number of significant */
                                        /*  digits in currency */
               char co_time;            /*Time format */
               long co_case;            /*Case map */
               char co_dasep[2];        /*Data separator*/
               char co_fill[10];        /*Filler*/
           };

    The format specified by 'co_date' is:

           0    for month, day, year, as in the United States
           1    for day, month, year, as in Europe
           2    for year, month, day, as in Japan

    The format specified by 'co_currstyle' is:

           0    Currency symbol before the value; no space between symbol
                and number.
           1    Currency symbol after the value; no space between number
                and symbol.
           2    Currency symbol before the value; space between symbol
                and number.
           3    Currency symbol after the value; space between number and
                symbol.

       Returns:     'countryp'

         Notes:     Country-specific values are MS-DOS-dependent and are
                    set according to the MS-DOS version being used.

   -------------------------------- Example ---------------------------------

    The following statements get the country information for the current
    country and use it to display the date in the correct format for the
    country.

           #include <stdio.h>   /* for printf */
           #include <dos.h>     /* for country, and structures date */

           main()
           {
               struct country  where;
               struct date     when;
               int  d1, d2, d3;

               getdate(&when);  /* get current date */
               country(0,&where);  /* get info for current country */
               switch (where.co_date) {
               case 0 :
                    d1 = when.da_mon;
                    d2 = when.da_day;
                    d3 = when.da_year;
                    break;
               case 1 :
                    d1 = when.da_day;
                    d2 = when.da_mon;
                    d3 = when.da_year;
                    break;
                case 2 :
                     d1 = when.da_year;
                     d2 = when.da_mon;
                     d3 = when.da_day;
                     break;
               }
               printf("The date is %d%s%d%s%d\n",d1,
                       where.co_dtsep,d2,where.co_dtsep,d3);
           }




Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson