How We Recommend Working with Characters and Strings
Based on what you’ve read in this chapter, the first part of this section summarizes what you should always keep in mind when developing your code. The second part of the section provides tips and tricks for better Unicode and ANSI string manipulations. It’s a good idea to start converting your application to be Unicode-ready even if you don’t plan to use Unicode right away. Here are the basic guidelines you should follow:
Start thinking of text strings as arrays of characters, not as arrays of
chars
or arrays of bytes.Use generic data types (such as
TCHAR/PTSTR
) for text characters and strings.Use explicit data types (such as
BYTE
andPBYTE
) for bytes, byte pointers, and data buffers.Use the ...
Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.