UniFreeUconvObject: Difference between revisions
Appearance
No edit summary |
mNo edit summary |
||
Line 3: | Line 3: | ||
=== Parameters === | === Parameters === | ||
; uconvObj - [[ | ; uconvObj - [[UconvObject]] - input : The conversion object created from [[UniCreateUconvObject]]. | ||
=== Constants === | === Constants === | ||
Line 12: | Line 12: | ||
* [[OS2 API:Unicode:error#ULS_BADOBJECT|ULS_BADOBJECT]] | * [[OS2 API:Unicode:error#ULS_BADOBJECT|ULS_BADOBJECT]] | ||
* [[OS2 API:Unicode:error#ULS_SUCCESS|ULS_SUCCESS]] | * [[OS2 API:Unicode:error#ULS_SUCCESS|ULS_SUCCESS]] | ||
=== Calling conversion === | === Calling conversion === | ||
Line 26: | Line 20: | ||
size_t unicodeBuffLen = 12; | size_t unicodeBuffLen = 12; | ||
ULONG codePage; | |||
ULONG cpLen; // length set by DosQueryCp | |||
UniChar unicodeBuff, // length of unicodeBuffLen | |||
tempPath; // length of CCHMAXPATH | tempPath; // length of CCHMAXPATH | ||
UconvObject uconvObj; | |||
character out; // allocate to CCHMAXPATH | character out; // allocate to CCHMAXPATH | ||
integer rc; | integer rc; | ||
Line 51: | Line 45: | ||
=== Related Functions === | === Related Functions === | ||
[[ | *[[UniCreateUconvObject]] | ||
[[ | *[[UniQueryUconvObject]] | ||
[[ | *[[UniSetUconvObject]] | ||
=== OS Version Introduced === | === OS Version Introduced === | ||
OS/2 Warp | OS/2 Warp | ||
[[Category:Uni]] | |||
[[Category: |
Revision as of 21:14, 4 December 2016
UniFreeUconvObject
- UniFreeUconvObject(uconvObj)
- Free the conversion object from memory.
Parameters
- uconvObj - UconvObject - input
- The conversion object created from UniCreateUconvObject.
Constants
None
Returns
An integer with values of:
Calling conversion
Example Code
character in = "C:\SOMEPATH\FILE.TXT"; size_t unicodeBuffLen = 12; ULONG codePage; ULONG cpLen; // length set by DosQueryCp UniChar unicodeBuff, // length of unicodeBuffLen tempPath; // length of CCHMAXPATH UconvObject uconvObj; character out; // allocate to CCHMAXPATH integer rc;
rc = DosQueryCp(size of ULONG, codePage, cpLen);
/* determine string for the conversion of codePage */ rc = UniMapCpToUcsCp(codePage, unicodeBuff, unicodeBuffLen); rc = UniCreateUconvObject(unicodeBuff, uconvObj); rc = UniStrToUcs(uconvObj, tempPath, in, CCHMAXPATH); rc = UniFreeUconvObject(uconvObj);
/* conversion for current codepage that can be used for paths */ rc = UniCreateUconvObject((UniChar pointer)L"@path=yes", uconvObj); rc = UniStrFromUcs(uconvObj, out, tempPath, CCHMAXPATH); rc = UniFreeUconvObject(uconvObj);
/* use out - don't forget to de-allocate out when finished with it. */ /* error checking left out for brevity */
Related Functions
OS Version Introduced
OS/2 Warp