DosQueryCp: Difference between revisions
Created page with "==Description== Allows a process to query its current process code page and the prepared system code pages. ==Syntax== <PRE> #define INCL_DOSNLS #include <os2.h> ULONG c..." |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Allows a process to query its current process code page and the prepared system code pages. | Allows a process to query its current process code page and the prepared system code pages. | ||
==Syntax== | ==Syntax== | ||
DosQueryCp(cb, arCP, pcCP) | |||
==Parameters== | ==Parameters== | ||
; | ;cb (ULONG) - input : The length, in bytes, of arCP. | ||
;arCP (PULONG) - output : The returned data list. | |||
; arCP (PULONG) - output : The returned data list. | :The first ULONG is the current code page identifier of the calling process. | ||
The first ULONG is the current code page identifier of the calling process. | :If one or two code pages have been prepared for the system, then the second ULONG is the first prepared code page, and the third ULONG is the second prepared code page. | ||
:If the data length is less than the number of bytes needed to return all of the prepared system code pages, then the returned list is truncated. | |||
If one or two code pages have been prepared for the system, then the second ULONG is the first prepared code page, and the third ULONG is the second prepared code page. | :The code page identifiers have the values described in the following [[Code pages|list]]. | ||
;pcCP (PULONG) - output : The length, in bytes, of the returned data. | |||
If the data length is less than the number of bytes needed to return all of the prepared system code pages, then the returned list is truncated. | |||
The code page identifiers have the values described in the following | |||
; pcCP (PULONG) - output : The length, in bytes, of the returned data. | |||
==Return Code== | ==Return Code== | ||
;ulrc (APIRET) - returns:DosQueryCp returns one of the following values: | |||
* 0 NO_ERROR | |||
DosQueryCp returns one of the following values: | * 473 ERROR_CPLIST_TOO_SMALL | ||
* 474 ERROR_CP_NOT_MOVED | |||
* 0 | |||
* 473 | |||
* 474 | |||
==Remarks== | ==Remarks== | ||
The process code page identifier previously set by [[DosSetProcessCp]] or inherited by the process is returned to the caller. An input list size of two bytes returns only the current process code page identifier. If no code pages have been prepared with the CODEPAGE command, a length of two and a current code page identifier value of zero are returned. | |||
Note: If no CODEPAGE= statement exists in CONFIG.SYS, the operating system uses the first codepage that it finds in the [[COUNTRY.SYS]] file for that country. | |||
Note: If no CODEPAGE= statement exists in CONFIG.SYS, the operating system uses the first codepage that it finds in the COUNTRY.SYS file for that country. | |||
The system code page identifiers are returned to the caller in the same order as they appear in the CODEPAGE command. The code page identifiers are returned in the following order: | The system code page identifiers are returned to the caller in the same order as they appear in the CODEPAGE command. The code page identifiers are returned in the following order: | ||
* The current code page of the process (one of the system code pages). | * The current code page of the process (one of the system code pages). | ||
* The primary (default) system code page. | * The primary (default) system code page. | ||
Line 72: | Line 31: | ||
==Example Code== | ==Example Code== | ||
This example gets the current code page and up to three other prepared code pages. | This example gets the current code page and up to three other prepared code pages. | ||
<PRE> | <PRE> | ||
#define INCL_DOSNLS /* National Language Support values */ | #define INCL_DOSNLS /* National Language Support values */ | ||
Line 100: | Line 58: | ||
return NO_ERROR; | return NO_ERROR; | ||
} | } | ||
</PRE> | |||
==Related Functions== | ==Related Functions== | ||
* [[ | *[[DosMapCase]] | ||
* [[ | *[[DosQueryCollate]] | ||
* [[ | *[[DosQueryCtryInfo]] | ||
* [[ | *[[DosQueryDBCSEnv]] | ||
* [[ | *[[DosSetProcessCp]] | ||
[[Category: | [[Category:Dos]] |
Latest revision as of 17:41, 12 October 2018
Allows a process to query its current process code page and the prepared system code pages.
Syntax
DosQueryCp(cb, arCP, pcCP)
Parameters
- cb (ULONG) - input
- The length, in bytes, of arCP.
- arCP (PULONG) - output
- The returned data list.
- The first ULONG is the current code page identifier of the calling process.
- If one or two code pages have been prepared for the system, then the second ULONG is the first prepared code page, and the third ULONG is the second prepared code page.
- If the data length is less than the number of bytes needed to return all of the prepared system code pages, then the returned list is truncated.
- The code page identifiers have the values described in the following list.
- pcCP (PULONG) - output
- The length, in bytes, of the returned data.
Return Code
- ulrc (APIRET) - returns
- DosQueryCp returns one of the following values:
- 0 NO_ERROR
- 473 ERROR_CPLIST_TOO_SMALL
- 474 ERROR_CP_NOT_MOVED
Remarks
The process code page identifier previously set by DosSetProcessCp or inherited by the process is returned to the caller. An input list size of two bytes returns only the current process code page identifier. If no code pages have been prepared with the CODEPAGE command, a length of two and a current code page identifier value of zero are returned.
Note: If no CODEPAGE= statement exists in CONFIG.SYS, the operating system uses the first codepage that it finds in the COUNTRY.SYS file for that country.
The system code page identifiers are returned to the caller in the same order as they appear in the CODEPAGE command. The code page identifiers are returned in the following order:
- The current code page of the process (one of the system code pages).
- The primary (default) system code page.
- The secondary system code page, if specified.
Example Code
This example gets the current code page and up to three other prepared code pages.
#define INCL_DOSNLS /* National Language Support values */ #define INCL_DOSERRORS /* DOS error values */ #include <os2.h> #include <stdio.h> int main(VOID) { ULONG aulCpList[8] = {0}, /* Code page list */ ulBufSize = 8 * sizeof(ULONG), /* Size of output list */ ulListSize = 0, /* Size of list returned */ indx = 0; /* Loop index */ APIRET rc = NO_ERROR; /* Return code */ rc = DosQueryCp(ulBufSize, /* Length of output code page list */ aulCpList, /* List of code pages */ &ulListSize); /* Length of list returned */ if (rc != NO_ERROR) { printf("DosQueryCp error: return code = %u\n",rc); return 1; } else { for (indx=0; indx < ulListSize/sizeof(ULONG); indx++) printf ("aulCpList[%u] = %u\n", indx, aulCpList[indx]); } return NO_ERROR; }