Become an application in accordance with ANSI and Unicode

zhaozj2021-02-16  80

Even if you don't intend to use Unicode immediately, it is best to turn your application into an unicode-in-app. Below are some of the basic principles that should be followed: 1, the text is sped as a character array, not a Chars array or byte array. 2. Use the general data type (such as TCHAR and PTSTR) for text characters and strings. 3. Use explicit data types (such as Byte and Pbyte) for bytes, byte pointers, and data caches. 4, will _text macro for primary characters and strings. 5. Perform a global replacement (for example with PTSTR replacement PSTR). 6. Modify the string operation problem. For example, functions typically want you to pass a cache size in characters, not bytes. This means that you should not pass SIZEOF (SizBuffer / SizeOf (Tchar)). 7. In addition, if you need to assign a memory block for a string, and have the number of characters in the string, keep in mind that you want to assign memory by byte. That is to say, Malloc (ncharacters * sizeof (tchar) should be called instead of calling Malloc (ncharacters). In all principles mentioned above, this is the most difficult principle that if the operation is wrong, the compiler will not issue any warnings.

转载请注明原文地址:https://www.9cbs.com/read-14616.html

New Post(0)