Skip to content

Commit 008878e

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#1628 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to master to sync with https://github.com/MicrosoftDocs/cpp-docs (branch master)
2 parents 14a1414 + 796fdb1 commit 008878e

8 files changed

Lines changed: 28 additions & 28 deletions

‎docs/text/general-mbcs-programming-advice.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.assetid: 7b541235-f3e5-4af0-b2c2-a0112cd5fbfb
99

1010
Use the following tips:
1111

12-
- For flexibility, use run-time macros such as `_tcschr` and `_tcscpy` when possible. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
12+
- For flexibility, use run-time macros such as `_tcschr` and `_tcscpy` when possible. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
1313

1414
- Use the C run-time `_getmbcp` function to get information about the current code page.
1515

@@ -28,4 +28,4 @@ Use the following tips:
2828
## See Also
2929

3030
[MBCS Programming Tips](../text/mbcs-programming-tips.md)<br/>
31-
[Incrementing and Decrementing Pointers](../text/incrementing-and-decrementing-pointers.md)
31+
[Incrementing and Decrementing Pointers](../text/incrementing-and-decrementing-pointers.md)

‎docs/text/generic-text-mappings-in-tchar-h.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
2-
title: "Generic-Text Mappings in Tchar.h"
2+
title: "Generic-Text Mappings in tchar.h"
33
ms.date: "11/04/2016"
44
f1_keywords: ["tchar.h"]
55
helpviewer_keywords: ["mapping generic-text", "generic-text mappings [C++]", "character sets [C++], generic-text mappings", "Unicode [C++], generic-text mappings", "MBCS [C++], generic-text mappings", "TCHAR.H data types, mapping", "mappings [C++], TCHAR.H"]
66
ms.assetid: 01e1bb74-5a01-4093-8720-68b6c1fdda80
77
---
8-
# Generic-Text Mappings in Tchar.h
8+
# Generic-Text Mappings in tchar.h
99

10-
To simplify the transporting of code for international use, the Microsoft run-time library provides Microsoft-specific generic-text mappings for many data types, routines, and other objects. You can use these mappings, which are defined in Tchar.h, to write generic code that can be compiled for single-byte, multibyte, or Unicode character sets, depending on a manifest constant that you define by using a `#define` statement. Generic-text mappings are Microsoft extensions that are not ANSI compatible.
10+
To simplify the transporting of code for international use, the Microsoft run-time library provides Microsoft-specific generic-text mappings for many data types, routines, and other objects. You can use these mappings, which are defined in tchar.h, to write generic code that can be compiled for single-byte, multibyte, or Unicode character sets, depending on a manifest constant that you define by using a `#define` statement. Generic-text mappings are Microsoft extensions that are not ANSI compatible.
1111

12-
By using the Tchar.h, you can build single-byte, Multibyte Character Set (MBCS), and Unicode applications from the same sources. Tchar.h defines macros (which have the prefix `_tcs`) that, with the correct preprocessor definitions, map to `str`, `_mbs`, or `wcs` functions, as appropriate. To build MBCS, define the symbol `_MBCS`. To build Unicode, define the symbol `_UNICODE`. To build a single-byte application, define neither (the default). By default, `_MBCS` is defined for MFC applications.
12+
By using the tchar.h, you can build single-byte, Multibyte Character Set (MBCS), and Unicode applications from the same sources. tchar.h defines macros (which have the prefix `_tcs`) that, with the correct preprocessor definitions, map to `str`, `_mbs`, or `wcs` functions, as appropriate. To build MBCS, define the symbol `_MBCS`. To build Unicode, define the symbol `_UNICODE`. To build a single-byte application, define neither (the default). By default, `_MBCS` is defined for MFC applications.
1313

14-
The `_TCHAR` data type is defined conditionally in Tchar.h. If the symbol `_UNICODE` is defined for your build, `_TCHAR` is defined as **wchar_t**; otherwise, for single-byte and MBCS builds, it is defined as **char**. (**wchar_t**, the basic Unicode wide-character data type, is the 16-bit counterpart to an 8-bit signed **char**.) For international applications, use the `_tcs` family of functions, which operate in `_TCHAR` units, not bytes. For example, `_tcsncpy` copies `n` `_TCHARs`, not `n` bytes.
14+
The `_TCHAR` data type is defined conditionally in tchar.h. If the symbol `_UNICODE` is defined for your build, `_TCHAR` is defined as **wchar_t**; otherwise, for single-byte and MBCS builds, it is defined as **char**. (**wchar_t**, the basic Unicode wide-character data type, is the 16-bit counterpart to an 8-bit signed **char**.) For international applications, use the `_tcs` family of functions, which operate in `_TCHAR` units, not bytes. For example, `_tcsncpy` copies `n` `_TCHARs`, not `n` bytes.
1515

1616
Because some Single Byte Character Set (SBCS) string-handling functions take (signed) `char*` parameters, a type mismatch compiler warning results when `_MBCS` is defined. There are three ways to avoid this warning:
1717

18-
1. Use the type-safe inline function thunks in Tchar.h. This is the default behavior.
18+
1. Use the type-safe inline function thunks in tchar.h. This is the default behavior.
1919

20-
1. Use the direct macros in Tchar.h by defining `_MB_MAP_DIRECT` on the command line. If you do this, you must manually match types. This is the fastest method, but is not type-safe.
20+
1. Use the direct macros in tchar.h by defining `_MB_MAP_DIRECT` on the command line. If you do this, you must manually match types. This is the fastest method, but is not type-safe.
2121

22-
1. Use the type-safe statically linked library function thunks in Tchar.h. To do so, define the constant `_NO_INLINING` on the command line. This is the slowest method, but the most type-safe.
22+
1. Use the type-safe statically linked library function thunks in tchar.h. To do so, define the constant `_NO_INLINING` on the command line. This is the slowest method, but the most type-safe.
2323

2424
### Preprocessor Directives for Generic-Text Mappings
2525

@@ -29,7 +29,7 @@ Because some Single Byte Character Set (SBCS) string-handling functions take (si
2929
|`_MBCS`|Multibyte-character|`_tcsrev` maps to `_mbsrev`|
3030
|None (the default has neither `_UNICODE` nor `_MBCS` defined)|SBCS (ASCII)|`_tcsrev` maps to `strrev`|
3131

32-
For example, the generic-text function `_tcsrev`, which is defined in Tchar.h, maps to `_mbsrev` if you defined `_MBCS` in your program, or to `_wcsrev` if you defined `_UNICODE`. Otherwise, `_tcsrev` maps to `strrev`. Other data type mappings are provided in Tchar.h for programming convenience, but `_TCHAR` is the most useful.
32+
For example, the generic-text function `_tcsrev`, which is defined in tchar.h, maps to `_mbsrev` if you defined `_MBCS` in your program, or to `_wcsrev` if you defined `_UNICODE`. Otherwise, `_tcsrev` maps to `strrev`. Other data type mappings are provided in tchar.h for programming convenience, but `_TCHAR` is the most useful.
3333

3434
### Generic-Text Data Type Mappings
3535

@@ -80,4 +80,4 @@ Therefore, you can write, maintain, and compile a single-source code file to run
8080
## See Also
8181

8282
[Text and Strings](../text/text-and-strings-in-visual-cpp.md)<br/>
83-
[Using TCHAR.H Data Types with _MBCS Code](../text/using-tchar-h-data-types-with-mbcs-code.md)
83+
[Using TCHAR.H Data Types with _MBCS Code](../text/using-tchar-h-data-types-with-mbcs-code.md)

‎docs/text/international-enabling.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Most traditional C and C++ code makes assumptions about character and string man
1616

1717
- Use the same portable run-time functions that make MFC portable under either environment.
1818

19-
- Make literal strings and characters portable under either environment, using the `_T` macro. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
19+
- Make literal strings and characters portable under either environment, using the `_T` macro. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
2020

2121
- Take precautions when parsing strings under MBCS. These precautions are not needed under Unicode. For more information, see [MBCS Programming Tips](../text/mbcs-programming-tips.md).
2222

@@ -30,4 +30,4 @@ Most traditional C and C++ code makes assumptions about character and string man
3030
## See Also
3131

3232
[Unicode and MBCS](../text/unicode-and-mbcs.md)<br/>
33-
[Internationalization Strategies](../text/internationalization-strategies.md)
33+
[Internationalization Strategies](../text/internationalization-strategies.md)

‎docs/text/internationalization-strategies.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Depending on your target operating systems and markets, you have several interna
1616

1717
You use MBCS-specific functionality. Strings can contain single-byte characters, double-byte characters, or both. The C run-time library provides functions, macros, and data types for MBCS-only programming. MFC is fully MBCS-enabled.
1818

19-
- The source code for your application is written for complete portability — by recompiling with the symbol `_UNICODE` or the symbol `_MBCS` defined, you can produce versions that use either. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
19+
- The source code for your application is written for complete portability — by recompiling with the symbol `_UNICODE` or the symbol `_MBCS` defined, you can produce versions that use either. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
2020

2121
You use fully portable C run-time functions, macros, and data types. MFC's flexibility supports any of these strategies.
2222

@@ -25,4 +25,4 @@ The remainder of these topics focus on writing completely portable code that you
2525
## See Also
2626

2727
[Unicode and MBCS](../text/unicode-and-mbcs.md)<br/>
28-
[Locales and Code Pages](../text/locales-and-code-pages.md)
28+
[Locales and Code Pages](../text/locales-and-code-pages.md)

‎docs/text/support-for-multibyte-character-sets-mbcss.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The C run-time library and MFC support single-byte, MBCS, and Unicode programmin
3636

3737
### MBCS/Unicode portability
3838

39-
Using the Tchar.h header file, you can build single-byte, MBCS, and Unicode applications from the same sources. Tchar.h defines macros prefixed with *_tcs* , which map to `str`, `_mbs`, or `wcs` functions, as appropriate. To build MBCS, define the symbol `_MBCS`. To build Unicode, define the symbol `_UNICODE`. By default, `_MBCS` is defined for MFC applications. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
39+
Using the tchar.h header file, you can build single-byte, MBCS, and Unicode applications from the same sources. Tchar.h defines macros prefixed with *_tcs* , which map to `str`, `_mbs`, or `wcs` functions, as appropriate. To build MBCS, define the symbol `_MBCS`. To build Unicode, define the symbol `_UNICODE`. By default, `_UNICODE` is defined for MFC applications. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
4040

4141
> [!NOTE]
4242
> Behavior is undefined if you define both `_UNICODE` and `_MBCS`.
@@ -60,4 +60,4 @@ For international portability, code your program with [Unicode](../text/support-
6060
## See Also
6161

6262
[Text and Strings](../text/text-and-strings-in-visual-cpp.md)<br/>
63-
[MBCS Support in Visual C++](../text/mbcs-support-in-visual-cpp.md)
63+
[MBCS Support in Visual C++](../text/mbcs-support-in-visual-cpp.md)

‎docs/text/text-and-strings-in-visual-cpp.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Describes Unicode, a specification for supporting all character sets, including
1919
[Support for Multibyte Character Sets (MBCS)](../text/support-for-multibyte-character-sets-mbcss.md)<br/>
2020
Discusses MBCS, an alternative to Unicode for supporting character sets, like Japanese and Chinese, that cannot be represented in a single byte.
2121

22-
[Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md)<br/>
22+
[Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md)<br/>
2323
Provides Microsoft-specific generic-text mappings for many data types, routines, and other objects.
2424

2525
[How to: Convert Between Various String Types](../text/how-to-convert-between-various-string-types.md)<br/>
@@ -34,4 +34,4 @@ Discusses international support in the C run-time library.
3434
Provides links to samples demonstrating internationalization in Visual C++.
3535

3636
[Language and Country/Region Strings](../c-runtime-library/locale-names-languages-and-country-region-strings.md)<br/>
37-
Provides the language and country/region strings in the C run-time library.
37+
Provides the language and country/region strings in the C run-time library.

‎docs/text/unicode-programming-summary.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ To take advantage of the MFC and C run-time support for Unicode, you need to:
1414

1515
- Specify entry point.
1616

17-
On the **Output** page of the **Linker** folder in the project's [Property Pages](../ide/property-pages-visual-cpp.md) dialog box, set the **Entry Point** symbol to `wWinMainCRTStartup`.
17+
On the **Advanced** page of the **Linker** folder in the project's [Property Pages](../ide/property-pages-visual-cpp.md) dialog box, set the **Entry Point** symbol to `wWinMainCRTStartup`.
1818

1919
- Use portable run-time functions and types.
2020

21-
Use the proper C run-time functions for Unicode string handling. You can use the `wcs` family of functions, but you might prefer the fully portable (internationally enabled) `_TCHAR` macros. These macros are all prefixed with `_tcs`; they substitute, one for one, for the `str` family of functions. These functions are described in detail in the [Internationalization](../c-runtime-library/internationalization.md) section of the *Run-Time Library Reference*. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
21+
Use the proper C run-time functions for Unicode string handling. You can use the `wcs` family of functions, but you might prefer the fully portable (internationally enabled) `_TCHAR` macros. These macros are all prefixed with `_tcs`; they substitute, one for one, for the `str` family of functions. These functions are described in detail in the [Internationalization](../c-runtime-library/internationalization.md) section of the *Run-Time Library Reference*. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
2222

2323
Use `_TCHAR` and the related portable data types described in [Support for Unicode](../text/support-for-unicode.md).
2424

@@ -79,10 +79,10 @@ To summarize, MFC and the run-time library provide the following support for Uni
7979

8080
- The run-time library supplies Unicode versions of all string-handling functions. (The run-time library also supplies portable versions suitable for Unicode or for MBCS. These are the `_tcs` macros.)
8181

82-
- Tchar.h supplies portable data types and the `_T` macro for translating literal strings and characters. For more information, see [Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md).
82+
- tchar.h supplies portable data types and the `_T` macro for translating literal strings and characters. For more information, see [Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md).
8383

8484
- The run-time library provides a wide-character version of `main`. Use `wmain` to make your application Unicode-aware.
8585

8686
## See Also
8787

88-
[Support for Unicode](../text/support-for-unicode.md)
88+
[Support for Unicode](../text/support-for-unicode.md)

‎docs/text/using-tchar-h-data-types-with-mbcs-code.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ When the manifest constant `_MBCS` is defined, a given generic-text routine maps
1515

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

18-
- Use the default behavior. Tchar.h provides generic-text routine prototypes for routines in the run-time libraries, as in the following example.
18+
- Use the default behavior. tchar.h provides generic-text routine prototypes for routines in the run-time libraries, as in the following example.
1919

2020
```cpp
2121
char * _tcsrev(char *);
@@ -29,7 +29,7 @@ Following are three solutions for preventing this type conflict (and the C compi
2929
#define _USE_INLINING
3030
```
3131

32-
This method causes an inline function thunk, provided in Tchar.h, to map the generic-text routine directly to the appropriate MBCS routine. The following code excerpt from Tchar.h provides an example of how this is done.
32+
This method causes an inline function thunk, provided in tchar.h, to map the generic-text routine directly to the appropriate MBCS routine. The following code excerpt from tchar.h provides an example of how this is done.
3333

3434
```cpp
3535
__inline char *_tcsrev(char *_s1)
@@ -44,7 +44,7 @@ Following are three solutions for preventing this type conflict (and the C compi
4444
#define _MB_MAP_DIRECT
4545
```
4646

47-
This approach provides a fast alternative if you do not want to use the default behavior or cannot use inlining. It causes the generic-text routine to be mapped by a macro directly to the MBCS version of the routine, as in the following example from Tchar.h.
47+
This approach provides a fast alternative if you do not want to use the default behavior or cannot use inlining. It causes the generic-text routine to be mapped by a macro directly to the MBCS version of the routine, as in the following example from tchar.h.
4848

4949
```cpp
5050
#define _tcschr _mbschr
@@ -54,4 +54,4 @@ Following are three solutions for preventing this type conflict (and the C compi
5454

5555
## See Also
5656

57-
[Generic-Text Mappings in Tchar.h](../text/generic-text-mappings-in-tchar-h.md)
57+
[Generic-Text Mappings in tchar.h](../text/generic-text-mappings-in-tchar-h.md)

0 commit comments

Comments
 (0)