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
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/write.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -35,19 +35,19 @@ Number of bytes.
35
35
36
36
## Return Value
37
37
38
-
If successful, **_write** returns the number of bytes actually written. If the actual space remaining on the disk is less than the size of the buffer the function is trying to write to the disk, **_write** fails and does not flush any of the buffer's contents to the disk. A return value of -1 indicates an error. If invalid parameters are passed, this function invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the function returns -1 and **errno** is set to one of three values: **EBADF**, which means the file descriptor is invalid or the file is not opened for writing; **ENOSPC**, which means there is not enough space left on the device for the operation; or **EINVAL**, which means that *buffer* was a null pointer or that an odd *count* of bytes was passed to be written to a file in Unicode mode.
38
+
If successful, **_write** returns the number of bytes written. If the actual space remaining on the disk is less than the size of the buffer the function is trying to write to the disk, **_write** fails and does not flush any of the buffer's contents to the disk. A return value of -1 indicates an error. If invalid parameters are passed, this function invokes the invalid parameter handler, as described in [Parameter Validation](../../c-runtime-library/parameter-validation.md). If execution is allowed to continue, the function returns -1 and **errno** is set to one of three values: **EBADF**, which means the file descriptor is invalid or the file is not opened for writing; **ENOSPC**, which means there is not enough space left on the device for the operation; or **EINVAL**, which means that *buffer* was a null pointer or that an odd *count* of bytes was passed to be written to a file in Unicode mode.
39
39
40
40
For more information about these and other return codes, see [errno, _doserrno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
41
41
42
-
If the file is opened in text mode, each line feed character is replaced with a carriage return-line feed pair in the output. The replacement does not affect the return value.
42
+
If the file is opened in text mode, each line feed character is replaced with a carriage return-line feed pair in the output. The replacement doesn't affect the return value.
43
43
44
-
When the file is opened in Unicode translation mode—for example, if *fd* is opened by using **_open** or **_sopen** and a mode parameter that includes **_O_WTEXT**, **_O_U16TEXT**, or **_O_U8TEXT**, or if it is opened by using **fopen** and a mode parameter that includes **ccs=UNICODE**, **ccs=UTF-16LE**, or **ccs=UTF-8**, or if the mode is changed to a Unicode translation mode by using **_setmode**—*buffer* is interpreted as a pointer to an array of **wchar_t** that contains **UTF-16** data. An attempt to write an odd number of bytes in this mode causes a parameter validation error.
44
+
When the file is opened in Unicode translation mode—for example, if *fd* is opened by using **_open** or **_sopen** and a mode parameter that includes **_O_WTEXT**, **_O_U16TEXT**, or **_O_U8TEXT**, or if it's opened by using **fopen** and a mode parameter that includes **ccs=UNICODE**, **ccs=UTF-16LE**, or **ccs=UTF-8**, or if the mode is changed to a Unicode translation mode by using **_setmode**—*buffer* is interpreted as a pointer to an array of **wchar_t** that contains **UTF-16** data. An attempt to write an odd number of bytes in this mode causes a parameter validation error.
45
45
46
46
## Remarks
47
47
48
-
The **_write** function writes *count* bytes from *buffer* into the file associated with *fd*. The write operation begins at the current position of the file pointer (if any) associated with the given file. If the file is open for appending, the operation begins at the current end of the file. After the write operation, the file pointer is increased by the number of bytes actually written.
48
+
The **_write** function writes *count* bytes from *buffer* into the file associated with *fd*. The write operation begins at the current position of the file pointer (if any) associated with the given file. If the file is open for appending, the operation begins at the current end of the file. After the write operation, the file pointer is increased by the number of bytes written.
49
49
50
-
When writing to files opened in text mode, **_write** treats a CTRL+Z character as the logical end-of-file. When writing to a device, **_write** treats a CTRL+Z character in the buffer as an output terminator.
50
+
When writing to files opened in text mode, **_write** treats a CTRL+Z character as the logical end of file. When writing to a device, **_write** treats a CTRL+Z character in the buffer as an output terminator.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/unicode-stream-i-o-in-text-and-binary-modes.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ When a Unicode stream I/O routine (such as **fwprintf**, **fwscanf**, **fgetwc**
13
13
14
14
- Carriage return-line feed (CR-LF) translation. This translation occurs before the MBCS - Unicode conversion (for Unicode stream input functions) and after the Unicode - MBCS conversion (for Unicode stream output functions). During input, each carriage return-line feed combination is translated into a single line feed character. During output, each line feed character is translated into a carriage return-line feed combination.
15
15
16
-
However, when a Unicode stream-I/O function operates in binary mode, the file is assumed to be Unicode, and no CR-LF translation or character conversion occurs during input or output. Use the _setmode( _fileno( stdin ), _O_BINARY ); instruction in order to correctly use wcin on a UNICODE text file.
16
+
However, when a Unicode stream-I/O function operates in binary mode, the file is assumed to be Unicode, and no CR-LF translation or character conversion occurs during input or output. Use the `_setmode( _fileno( stdin ), _O_BINARY );` instruction in order to correctly use `wcin` on a UNICODE text file.
0 commit comments