Using TCHAR.H Data Types with _MBCS

Microsoft Specific —>

As the table of generic-text routine mappings indicates (see Appendix B, Generic-Text Mappings), when the manifest constant _MBCS is defined, a given generic-text routine maps to one of the following kinds of routines:

Following are three solutions for preventing this type conflict (and the C compiler warnings or C++ compiler errors that would result):

When you take this approach, you must be careful to ensure that appropriate data types are used for string arguments and string return values. You can use type casting to ensure proper type matching or you can use the _TXCHAR generic-text data type. _TXCHAR maps to type char in SBCS code but maps to type unsigned char in MBCS code. For more information about generic-text macros, see Appendix B, Generic-Text Mappings.

END Microsoft Specific