Annotation of os2sdk/demos/examples/country/country.c, revision 1.1.1.2

1.1       root        1: /*
1.1.1.2 ! root        2:  * Example of DosGetCtryInfo usage
1.1       root        3:  *
1.1.1.2 ! root        4:  * This routine is an example of how to get country dependant
1.1       root        5:  * information. This program works Family API. IMPORTANT NOTE: In order
                      6:  * to run this in Family API under DOS 2/3 you must put a copy of the
1.1.1.2 ! root        7:  * OS/2 file "country.sys" in the root directory of your boot drive.
1.1       root        8:  *
                      9:  * Compile as: cl -AL -Lp -G0 country.c
                     10:  *
1.1.1.2 ! root       11:  * Created by Microsoft Corp. 1986
1.1       root       12:  */
                     13: 
1.1.1.2 ! root       14: #define INCL_DOSNLS
        !            15: #define INCL_DOSPROCESS
        !            16: 
        !            17: #include  <os2def.h>
        !            18: #include  <bsedos.h>
1.1       root       19: 
                     20: 
                     21: main()
                     22: {
1.1.1.2 ! root       23:        COUNTRYCODE CountryCode;        /* Numeric code for country */
        !            24:        COUNTRYINFO Buffa;              /* Buffer to receive country info */
        !            25:        USHORT DataLength;              /* Length actually copied into buffer */
1.1       root       26:        /*
                     27:         * Get current country code and related information.
1.1.1.2 ! root       28:         * DosGetCtryInfo will return an error code if LENGTH
1.1       root       29:         * is less than the actual amount of information,
                     30:         * however as much information as possible will be
                     31:         * copied to MemoryBuffer.
                     32:         *
                     33:         * CountryCode = 0 means return current info, else
                     34:         * return info for a particular code.
                     35:         */
                     36:        CountryCode.country=0;
                     37:        CountryCode.codepage=0;
1.1.1.2 ! root       38:        DosGetCtryInfo(sizeof(Buffa), &CountryCode, &Buffa , &DataLength);
1.1       root       39:       
                     40:        /* Display current country code and currency symbol */
                     41:        printf("Current country code: %d\n", CountryCode.country);
1.1.1.2 ! root       42:        printf("Currency Indicator: %s\n", Buffa.szCurrency);
1.1       root       43: 
1.1.1.2 ! root       44:        DosExit(EXIT_PROCESS,0);
1.1       root       45: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.