Skip to content

Commit 450eefa

Browse files
authored
Update remarks and behavior summary sections
The behavior in debug mode applies to all functions on this page, so made more prominent.
1 parent 3f711f8 commit 450eefa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/c-runtime-library/reference/vsnprintf-s-vsnprintf-s-vsnprintf-s-l-vsnwprintf-s-vsnwprintf-s-l.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ See [Behavior summary](#behavior-summary) for details.
105105

106106
## Remarks
107107

108-
**`vsnprintf_s`** is identical to **`_vsnprintf_s`** and is included for conformance to the ANSI standard. **`_vnsprintf`** is retained for backward compatibility.
109-
110108
Each of these functions takes a pointer to an argument list, then formats and writes up to *`count`* characters of the given data to the memory pointed to by *`buffer`* and appends a terminating null.
111109

110+
In debug builds, the remaining `sizeOfBuffer` bytes following the terminating NULL are filled with 'xFE' as described in [`_CrtSetDebugFillThreshold`](crtsetdebugfillthreshold.md).
111+
112112
The versions of these functions with the **`_l`** suffix are identical except that they use the locale parameter passed in instead of the current thread locale.
113113

114+
**`vsnprintf_s`** is identical to **`_vsnprintf_s`** and is included for conformance to the ANSI standard. **`_vnsprintf`** is retained for backward compatibility.
115+
114116
### Behavior summary
115117

116118
For the following table:
@@ -127,7 +129,7 @@ For the following table:
127129
| `buffer == NULL` and `sizeOfBuffer == 0` and `count == 0` | No data is written. | 0 | N/A | No |
128130
| `buffer == NULL` and either `sizeOfBuffer != 0` or `count != 0` | If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value.| -1 | `EINVAL` (22) | Yes |
129131
| `buffer != NULL` and `sizeOfBuffer == 0` | No data is written. If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 | `EINVAL` (22) | Yes |
130-
| `buffer != NULL` and `sizeOfBuffer != 0` and `count == 0` | The buffer is NULL terminated. In DEBUG builds, the remaining `sizeOfBuffer` bytes are filled with 'xFE' as described in [`_CrtSetDebugFillThreshold`](crtsetdebugfillthreshold.md). | -1 | N/A | No |
132+
| `buffer != NULL` and `sizeOfBuffer != 0` and `count == 0` | The buffer is NULL terminated. | -1 | N/A | No |
131133
| `count == 0`| Doesn't write any data and returns the number of characters that would have been written, not including the terminating `NULL`. | The number of characters that would have been written not including the terminating `NULL`. | N/A | No |
132134
| `count < 0` | Unsafe: the value is treated as unsigned, likely creating a large value that results in overwriting the memory that follows the buffer. | The number of characters written, not including the terminating `NULL`. | N/A | No |
133135
| `count < sizeOfBuffer` and `len <= count` | All of the data is written and a terminating `NULL` is appended. | The number of characters written. | N/A | No |

0 commit comments

Comments
 (0)