You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cdce1ec
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/snprintf-s-snprintf-s-l-snwprintf-s-snwprintf-s-l.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,20 +101,20 @@ For the following table, let `len` be the size of the formatted data. If the fun
101
101
102
102
| Condition | Behavior | Return value |`errno`| Invokes invalid parameter handler as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md)|
103
103
|--|--|--|--|--|
104
-
| Success | Writes the characters (wide characters for **`_snwprintf`**) into the buffer using the specified format string| The number of characters written, not including the terminating `NULL`| N/A | No |
105
-
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops | -1 |`EILSEQ (42)`| No |
106
-
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error | The number of characters written, not including the terminating `NULL`|`EILSEQ (42)`| No |
107
-
|`buffer == NULL` and `sizeOfBuffer == 0` and `count == 0`| No data is written | 0 | N/A | No |
104
+
| Success | Writes the characters (wide characters for **`_snwprintf`**) into the buffer using the specified format string.| The number of characters written, not including the terminating `NULL`.| N/A | No |
105
+
| Encoding error during formatting.| If processing string specifier `s`, `S`, or `Z`, format specification processing stops.| -1 |`EILSEQ` (42) | No |
106
+
| Encoding error during formatting.| If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error.| The number of characters written, not including the terminating `NULL`.|`EILSEQ` (42) | No |
107
+
|`buffer == NULL` and `sizeOfBuffer == 0` and `count == 0`| No data is written.| 0 | N/A | No |
108
108
|`buffer == NULL` and `sizeOfBuffer != 0` or `count != 0`| If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
109
-
|`buffer != NULL` and `sizeOfBuffer == 0`| No data is written | -1 |`EINVAL` (22) | Yes |
110
-
|`count == 0`| A `NULL` is placed at the beginning of the buffer | -1 | N/A | No |
109
+
|`buffer != NULL` and `sizeOfBuffer == 0`| No data is written.| -1 |`EINVAL` (22) | Yes |
110
+
|`count == 0`| A `NULL` is placed at the beginning of the buffer.| -1 | N/A | No |
111
111
|`count <= 0`| Unsafe: the value is treated as unsigned, likely creating a very 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 |
112
-
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended | The number of characters or wide characters written | N/A | No |
112
+
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended | The number of characters or wide characters written.| N/A | No |
113
113
|`count < sizeOfBuffer` and `len > count`| The first *`count`* characters are written and a terminating `NULL` is appended. Remaining data isn't written. | -1 | N/A | No |
114
-
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`| The number of characters written | N/A | No |
114
+
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`.| The number of characters written.| N/A | No |
115
115
|`count >= sizeOfBuffer` and `len >= sizeOfBuffer` and `count != _TRUNCATE`| If execution continues after invalid parameter handler executes, sets `buffer[0] == NULL`. | -1 |`ERANGE` (34) | Yes |
116
-
|`count == _TRUNCATE` and `len >= sizeOfBuffer`| Writes as much of the string as fits in *`buffer`*(with terminating `NULL`)| -1 | N/A | No |
117
-
|`count == _TRUNCATE` and `len < sizeOfBuffer`| Writes the entire string into *`buffer`* with terminating `NULL`| Number of characters written, not including the terminating `NULL`| N/A | No |
116
+
|`count == _TRUNCATE` and `len >= sizeOfBuffer`| Writes as much of the string as fits in *`buffer`*and a terminating `NULL`.| -1 | N/A | No |
117
+
|`count == _TRUNCATE` and `len < sizeOfBuffer`| Writes the entire string into *`buffer`* with a terminating `NULL`.| Number of characters written, not including the terminating `NULL`.| N/A | No |
118
118
|`format == NULL`| No data is written. If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
119
119
120
120
For information about these and other error codes, see [`_doserrno`, `errno`, `_sys_errlist`, and `_sys_nerr`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ For more information, see [Format specification syntax: `printf` and `wprintf` f
109
109
110
110
## Return value
111
111
112
-
The number of characters that which would have been written to the buffer if `count` was ignored. The count doesn't include the trailing`NULL` character.
112
+
The number of characters that which would have been written to the buffer if `count` was ignored. The count doesn't include the terminating`NULL` character.
113
113
114
114
Let **`len`** be the length of the formatted data string, not including the terminating `NULL`.\
115
115
For all functions, if `len < count`, then **`len`** characters are stored in *`buffer`*, a null-terminator is appended, and the number of characters written, not including the terminating `NULL`, is returned.
@@ -136,16 +136,16 @@ For the following table:
136
136
137
137
| Condition | Behavior | Return value |`errno`| Invokes invalid parameter handler as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md)|
138
138
|--|--|--|--|--|
139
-
| Success | Writes the characters (wide characters for **`_snwprintf`**) into the buffer using the specified format string | The number of characters written | N/A | No |
140
-
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops, a NULL is placed at the beginning of the buffer | -1 |`EILSEQ (42)`| No |
141
-
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error | The number of characters written, not including the terminating `NULL`|`EILSEQ (42)`| No |
139
+
| Success | Writes the characters (wide characters for **`_snwprintf`**) into the buffer using the specified format string.| The number of characters written.| N/A | No |
140
+
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops, a `NULL` is placed at the beginning of the buffer.| -1 |`EILSEQ` (42) | No |
141
+
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error.| The number of characters written, not including the terminating `NULL`.|`EILSEQ` (42) | No |
142
142
|`buffer == NULL` and `count != 0`| If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
143
-
|`count == 0`| Calculates the number of characters required to store the output | The number of characters required to store the output, not including the trailing`NULL`. | N/A | No |
144
-
|`count < 0`| Unsafe: the value is treated as unsigned, likely creating a very large value that results in overwriting the memory that follows the buffer | The number of characters written | N/A | No |
145
-
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended | The number of characters or wide characters written, not including the terminating `NULL`| N/A | No |
146
-
|`count < sizeOfBuffer` and `len > count`| The first *`count-1`* characters are written and a terminating `NULL` is appended. Remaining data isn't written. | The number of characters that would have been written had `count` matched the number of characters to output, not including the null-terminator | N/A | No |
147
-
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`| The number of characters written, not including the terminating `NULL`| N/A | No |
148
-
|`count >= sizeOfBuffer``len >= sizeOfBuffer`| Unsafe: the value is treated as unsigned, potentially creating a very 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 |
143
+
|`count == 0`| Calculates the number of characters required to store the output.| The number of characters required to store the output, not including the terminating`NULL`. | N/A | No |
144
+
|`count < 0`| Unsafe: the value is treated as unsigned, likely creating a very large value that results in overwriting the memory that follows the buffer.| The number of characters written | N/A | No |
145
+
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended.| The number of characters or wide characters written, not including the terminating `NULL`.| N/A | No |
146
+
|`count < sizeOfBuffer` and `len > count`| The first *`count-1`* characters are written and a terminating `NULL` is appended. Remaining data isn't written. | The number of characters that would have been written had `count` matched the number of characters to output, not including the null-terminator.| N/A | No |
147
+
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`.| The number of characters written, not including the terminating `NULL`| N/A | No |
148
+
|`count >= sizeOfBuffer`and `len >= sizeOfBuffer`| Unsafe: the value is treated as unsigned, potentially creating a very 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 |
149
149
|`format == NULL`| No data is written. If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
150
150
151
151
For information about these and other error codes, see [`errno`, `_doserrno`, `_sys_errlist`, and `_sys_nerr`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/vsnprintf-s-vsnprintf-s-vsnprintf-s-l-vsnwprintf-s-vsnwprintf-s-l.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,17 +119,17 @@ For the following table, let `len` be the size of the formatted data. If the fun
119
119
|--|--|--|--|--|
120
120
| Success | Writes the characters (wide characters for **`_vsnwprintf_s`**) into the buffer using the specified format string | The number of characters written | N/A | No |
121
121
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops | -1 |`EILSEQ (42)`| No |
122
-
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error | The number of characters written, not including the terminating `NULL`|`EILSEQ (42)`| No |
123
-
|`buffer == NULL` and `sizeOfBuffer == 0` and `count == 0`| No data is written | 0 | n/a | No |
122
+
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error | The number of characters written, not including the terminating `NULL`.|`EILSEQ (42)`| No |
123
+
|`buffer == NULL` and `sizeOfBuffer == 0` and `count == 0`| No data is written.| 0 | n/a | No |
124
124
|`buffer == NULL` and `sizeOfBuffer != 0` or `count != 0`| If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value.| -1 |`EINVAL` (22) | Yes |
125
-
|`buffer != NULL` and `sizeOfBuffer == 0`| No data is written | -1 |`EINVAL` (22) | Yes |
125
+
|`buffer != NULL` and `sizeOfBuffer == 0`| No data is written.| -1 |`EINVAL` (22) | Yes |
126
126
|`count <= 0`| If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
127
-
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended | The number of characters or wide characters written | N/A | No |
127
+
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended.| The number of characters or wide characters written.| N/A | No |
128
128
|`count < sizeOfBuffer` and `len > count`| The first *`count`* characters are written. Remaining data is truncated. | -1 | N/A | No |
129
-
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`| The number of characters written, not including the terminating `NULL`| N/A | No |
129
+
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`| The number of characters written, not including the terminating `NULL`.| N/A | No |
130
130
|`count >= sizeOfBuffer` and `len >= sizeOfBuffer` and `count != _TRUNCATE`| If execution continues after invalid parameter handler executes, sets `buffer[0] == NULL`. | -1 |`ERANGE` (34) | Yes |
131
-
|`count == _TRUNCATE` and `len >= sizeOfBuffer`| Writes as much of the string as fits in *`buffer`*, including the terminating `NULL`| -1 | N/A | No |
132
-
|`count == _TRUNCATE` and `len < sizeOfBuffer`| Writes the entire string into *`buffer`* with terminating `NULL`| Number of characters written | N/A | No |
131
+
|`count == _TRUNCATE` and `len >= sizeOfBuffer`| Writes as much of the string as fits in *`buffer`*, including the terminating `NULL`.| -1 | N/A | No |
132
+
|`count == _TRUNCATE` and `len < sizeOfBuffer`| Writes the entire string into *`buffer`* with terminating `NULL`.| Number of characters written.| N/A | No |
133
133
|`format == NULL`| No data is written. If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
134
134
135
135
For information about these and other error codes, see [`_doserrno`, `errno`, `_sys_errlist`, and `_sys_nerr`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/vsnprintf-vsnprintf-vsnprintf-l-vsnwprintf-vsnwprintf-l.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,17 +148,18 @@ For the following table:
148
148
149
149
| Condition | Behavior | Return value |`errno`| Invokes invalid parameter handler as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md)|
150
150
|--|--|--|--|--|
151
-
| Success | Writes the characters (wide characters for **`_vsnwprintf`**) into the buffer using the specified format string | The number of characters written, not counting the terminating null character | N/A | No |
152
-
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops | -1 |`EILSEQ (42)`| No |
153
-
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error | The number of characters written, not including the terminating `NULL`|`EILSEQ (42)`| No |
151
+
| Success | Writes the characters (wide characters for **`_vsnwprintf`**) into the buffer using the specified format string.| The number of characters written, not counting the terminating null character.| N/A | No |
152
+
| Encoding error during formatting | If processing string specifier `s`, `S`, or `Z`, format specification processing stops.| -1 |`EILSEQ` (42) | No |
153
+
| Encoding error during formatting | If processing character specifier `c` or `C`, the invalid character is skipped. The number of characters written isn't incremented for the skipped character, nor is any data written for it. Processing the format specification continues after skipping the specifier with the encoding error.| The number of characters written, not including the terminating `NULL`.|`EILSEQ` (42) | No |
154
154
|`buffer == NULL` and `count != 0`| If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value.| -1 |`EINVAL` (22) | Yes |
155
-
|`count == 0`| No data is written | The number of characters that would have been written, not including the terminating `NULL`. You can use this result to allocate sufficient buffer space for the string and a terminating `NULL`, and then call the function again to fill the buffer. |n/a| No |
156
-
|`count < 0`| Unsafe: the value is treated as unsigned, likely creating a very large value that results in overwriting the memory that follows the buffer | The number of characters written | N/A | No |
157
-
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended | The number of characters or wide characters written, not including the terminating `NULL`| N/A | No |
158
-
|`count < sizeOfBuffer` and `len > count`| The first *`count-1`* characters are written followed by a null-terminator. Remaining data is truncated. | The number of characters that would have been written had `count` matched the number of characters to output, not including the null-terminator | N/A | No |
159
-
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`| The number of characters written, not including the terminating `NULL`| N/A | No |
160
-
|`count >= sizeOfBuffer` and `len > = sizeOfBuffer`| Unsafe: the value is treated as unsigned, potentially creating a very 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 |
155
+
|`count == 0`| No data is written | The number of characters that would have been written, not including the terminating `NULL`. You can use this result to allocate sufficient buffer space for the string and a terminating `NULL`, and then call the function again to fill the buffer. |N/A| No |
156
+
|`count < 0`| Unsafe: the value is treated as unsigned, likely creating a very large value that results in overwriting the memory that follows the buffer.| The number of characters written.| N/A | No |
157
+
|`count < sizeOfBuffer` and `len <= count`| All of the data is written and a terminating `NULL` is appended.| The number of characters or wide characters written, not including the terminating `NULL`.| N/A | No |
158
+
|`count < sizeOfBuffer` and `len > count`| The first *`count-1`* characters are written followed by a null-terminator. Remaining data is truncated. | The number of characters that would have been written had `count` matched the number of characters to output, not including the null-terminator.| N/A | No |
159
+
|`count >= sizeOfBuffer` and `len < sizeOfBuffer`| All of the data is written with a terminating `NULL`.| The number of characters written, not including the terminating `NULL`.| N/A | No |
160
+
|`count >= sizeOfBuffer` and `len > = sizeOfBuffer`| Unsafe: the value is treated as unsigned, potentially creating a very 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 |
161
161
|`format == NULL`| No data is written. If execution continues after invalid parameter handler executes, sets `errno` and returns a negative value. | -1 |`EINVAL` (22) | Yes |
162
+
162
163
For information about these and other error codes, see [`_doserrno`, `errno`, `_sys_errlist`, and `_sys_nerr`](../errno-doserrno-sys-errlist-and-sys-nerr.md).
0 commit comments