This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS
Note: This is legacy API call. It is recommended to use 32-bit equivalent
This call allows a process to query the current process code page and the prepared system code pages.
DosGetCp (Length, CodePageList, DataLength)
rc (USHORT) - return:Return code
If the process code page identifier was previously set by DosSetCp or inherited by a process, it is returned to the caller.
An input list size (length) of two bytes returns only the current process code page identifier. If CodePageList length is too small to hold all the available information, then as much information as possible is provided in the available space and ERROR_CPLIST_TOO_SMALL is returned.
If no codepages were prepared with the CODEPAGE command, a length of two and current codepage identifier value of zero is returned.
Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetCp when coding for the DOS mode:
The current process code page, and no more than one prepared system code page, is returned.
#define INCL_DOSNLS USHORT rc = DosGetCp(Length, CodePageList, DataLength); USHORT Length; /* Length of list */ PUSHORT CodePageList; /* List (returned) */ PUSHORT DataLength; /* Length of list (returned) */ USHORT rc; /* return code */
EXTRN DosGetCp:FAR INCL_DOSNLS EQU 1 PUSH WORD Length ;Length of list PUSH@ WORD CodePageList ;List (returned) PUSH@ WORD DataLength ;Length of list (returned) CALL DosGetCp Returns WORD
This example gets the current code page and then up to 3 other prepared codepages.
#define INCL_DOSNLS USHORT CpList[8]; USHORT CpSize; USHORT rc; rc = DosGetCp(sizeof(CpList), /* Length of list */ CpList, /* List */ &CpSize); /* Length of returned list */