|
1 | 1 | ---
|
2 | 2 | description: "Learn more about: _cprintf_p, _cprintf_p_l, _cwprintf_p, _cwprintf_p_l"
|
3 | 3 | title: "_cprintf_p, _cprintf_p_l, _cwprintf_p, _cwprintf_p_l"
|
4 |
| -ms.date: "11/04/2016" |
| 4 | +ms.date: "3/9/2021" |
5 | 5 | api_name: ["_cprintf_p_l", "_cwprintf_p_l", "_cwprintf_p", "_cprintf_p"]
|
6 | 6 | api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll"]
|
7 | 7 | api_type: ["DLLExport"]
|
8 | 8 | topic_type: ["apiref"]
|
9 | 9 | f1_keywords: ["cprintf_p", "cwprintf_p", "tcprintf_p", "_cwprintf_p_l", "_cprintf_p", "csprintf_p_l", "_cprintf_p_l", "_cwprintf_p", "_tcprintf_p", "cprintf_p_l"]
|
10 | 10 | helpviewer_keywords: ["_cwprintf_p_l function", "cwprintf_p function", "tcprintf_p_l function", "cprintf_p_l function", "_tcprintf_p function", "_tcprintf_p_l function", "_cprintf_p function", "_cprintf_p_l function", "cwprintf_p_l function", "_cwprintf_p function", "tcprintf_p function", "cprintf_p function"]
|
11 |
| -ms.assetid: 1f82fd7d-13c8-4c4a-a3e4-db0df3873564 |
12 | 11 | ---
|
13 | 12 | # _cprintf_p, _cprintf_p_l, _cwprintf_p, _cwprintf_p_l
|
14 | 13 |
|
@@ -63,10 +62,13 @@ Unlike the **fprintf_p**, **printf_p**, and **sprintf_p** functions, neither **_
|
63 | 62 |
|
64 | 63 | The versions of these functions with the **_l** suffix are identical except that they use the locale parameter passed in instead of the current locale.
|
65 | 64 |
|
| 65 | +Also, like **_cprintf_s** and **_cwprintf_s**, they validate the input pointer and the format string. If *format* or *argument* are **NULL**, or of the format string contains invalid formatting characters, these functions invoke the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, these functions return -1 and set **errno** to **EINVAL**. |
| 66 | + |
66 | 67 | > [!IMPORTANT]
|
67 | 68 | > Ensure that *format* is not a user-defined string.
|
68 |
| -
|
69 |
| -Also, like **_cprintf_s** and **_cwprintf_s**, they validate the input pointer and the format string. If *format* or *argument* are **NULL**, or of the format string contains invalid formatting characters, these functions invoke the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, these functions return -1 and set **errno** to **EINVAL**. |
| 69 | +> |
| 70 | +> |
| 71 | +> Starting in Windows 10 version 2004 (build 19041), the `printf` family of functions prints exactly representable floating point numbers according to the IEEE 754 rules for rounding. In previous versions of Windows, exactly representable floating point numbers ending in '5' would always round up. IEEE 754 states that they must round to the closest even digit (also known as "Banker's Rounding"). For example, both `printf("%1.0f", 1.5)` and `printf("%1.0f", 2.5)` should round to 2. Previously, 1.5 would round to 2 and 2.5 would round to 3. This change only affects exactly representable numbers. For example, 2.35 (which, when represented in memory, is closer to 2.35000000000000008) continues to round up to 2.4. Rounding done by these functions now also respects the floating point rounding mode set by [`fesetround`](fegetround-fesetround2.md). Previously, rounding always chose `FE_TONEAREST` behavior. This change only affects programs built using Visual Studio 2019 version 16.2 and later. To use the legacy floating point rounding behavior, link with [`legacy_stdio_float_rounding.obj`](../link-options.md). |
70 | 72 |
|
71 | 73 | ### Generic-Text Routine Mappings
|
72 | 74 |
|
|
0 commit comments