Unicode Conversion to IntegersLast reviewed: January 15, 1998Article ID: Q89295 |
3.10 3.50
WINDOWS NT
kbprg
The information in this article applies to:
SUMMARYUnder Windows NT, strings may be either Unicode or ANSI. There is no function for reliably converting a string that might be either Unicode or ANSI to an integer. This is because, given a random set of bytes, it is difficult to determine whether the string is in Unicode or ANSI. The calling program has to know which format the string uses in order to convert it. If the string uses Unicode, the functions wcstol(), wcstoul(), and wcstod() can be used to perform the conversion. Note that when you are using the Win32 application programming interface (API), you can choose what kind of characters you get from the console or window manager. The names of the API functions that are called to use Unicode and ANSI characters are different. For more details, see Chapter 93 in the overview, "Unicode." To mark a string as Unicode, insert the byte-ordering-mark (BOM) 0xFEFF in the string and/or file.
MORE INFORMATIONYou can assume that the first 128 bytes in each character set are in the same codepoint. For portability, you should code character conversions in this range as:
{ TCHAR c; ... i = c - TEXT('0'); }The TEXT macro places an "L" before the constant if Unicode is defined.
|
Additional reference words: 3.10 3.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |