O'Reilly logo

Windows® via C/C++, Fifth Edition by Christophe Nasarre, Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 and PBYTE) for bytes, byte pointers, and data buffers.

  • Use the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required