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/fopen-s-wfopen-s.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ errno_t _wfopen_s(
34
34
A pointer to the file pointer that receives the pointer to the opened file.
35
35
36
36
*`filename`*\
37
-
The file to open.
37
+
The name of the file to open.
38
38
39
39
*`mode`*\
40
40
Type of access permitted.
@@ -115,7 +115,7 @@ In addition to the previous values, the following characters can be included in
115
115
116
116
|*`mode`* modifier | Translation mode |
117
117
|--|--|
118
-
|**`t`**| Open in text (translated) mode. In this mode, carriage return-line feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. |
118
+
|**`t`**| Open in text (translated) mode. Carriage return-line feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated to CR-LF combinations on output. CTRL+Z is interpreted as an end-of-file character on input. |
119
119
|**`b`**| Open in binary (untranslated) mode; translations involving carriage-return and line feed characters are suppressed. |
120
120
121
121
In text (translated) mode, `CTRL`+**Z** is interpreted as an end-of-file character on input. For files opened for reading/writing with **`"a+"`**, **`fopen_s`** checks for a `CTRL`+**Z** at the end of the file and removes it, if possible. It's removed because using [`fseek`](fseek-fseeki64.md) and [`ftell`](ftell-ftelli64.md) to move within a file that ends with a `CTRL`+**Z**, may cause **`fseek`** to behave improperly near the end of the file.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fopen-wfopen.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,7 @@ In addition to the earlier values, the following characters can be appended to *
106
106
107
107
|*`mode`* modifier | Translation mode |
108
108
|--|--|
109
-
|**`t`**| Open in text (translated) mode. In this mode, carriage return-line feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. |
109
+
|**`t`**| Open in text (translated) mode. Carriage return-line feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. |
110
110
|**`b`**| Open in binary (untranslated) mode; translations involving carriage-return and line feed characters are suppressed. |
111
111
112
112
In text mode, `CTRL`+**Z** is interpreted as an EOF character on input. In files that are opened for reading/writing by using **`"a+"`**, **`fopen`** checks for a `CTRL`+**Z** at the end of the file and removes it, if it's possible. It's removed because using [`fseek`](fseek-fseeki64.md) and **`ftell`** to move within a file that ends with `CTRL`+**Z** may cause [`fseek`](fseek-fseeki64.md) to behave incorrectly near the end of the file.
@@ -128,7 +128,7 @@ The following options can be appended to *`mode`* to specify more behaviors.
128
128
|**`S`**| Specifies that caching is optimized for, but not restricted to, sequential access from disk. |
129
129
|**`R`**| Specifies that caching is optimized for, but not restricted to, random access from disk. |
130
130
|**`T`**| Specifies a file that isn't written to disk unless memory pressure requires it. |
131
-
|**`D`**| Specifies a temporary file that is deleted when the last file pointer to it is closed. |
131
+
|**`D`**| Specifies a temporary file that's deleted when the last file pointer to it is closed. |
132
132
|**`ccs=encoding`**| Specifies the encoded character set to use (one of **`UTF-8`**, **`UTF-16LE`**, or `UNICODE`) for this file. Leave unspecified if you want ANSI encoding. This flag is separated from flags that precede it by a comma (`,`). For example: `FILE *f = fopen("newfile.txt", "rt+, ccs=UTF-8");`|
133
133
134
134
Valid characters for the *`mode`* string that is used in **`fopen`** and **`_fdopen`** correspond to *`oflag`* arguments that are used in [`_open`](open-wopen.md) and [`_sopen`](sopen-wsopen.md), as follows.
Copy file name to clipboardExpand all lines: docs/c-runtime-library/reference/fsopen-wfsopen.md
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ When a file is opened with the **"`a`"** or **"`a+`"** access type, all write op
68
68
|---|---|
69
69
|**`t`**| Opens a file in text (translated) mode. In this mode, carriage return-line feed (CR-LF) combinations are translated into single line feeds (LF) on input and LF characters are translated to CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading or reading/writing, **`_fsopen`** checks for a CTRL+Z at the end of the file and removes it, if possible. It's removed because using [`fseek`](fseek-fseeki64.md) and [`ftell`](ftell-ftelli64.md) to move within a file that ends with a CTRL+Z might cause [`fseek`](fseek-fseeki64.md) to behave improperly near the end of the file. |
70
70
|**`b`**| Opens a file in binary (untranslated) mode; the above translations are suppressed. |
71
-
|**`D`**| Specifies a temporary file that is deleted when the last file pointer to it is closed. |
71
+
|**`D`**| Specifies a temporary file that's deleted when the last file pointer to it is closed. |
72
72
|**`R`**| Specifies that caching is optimized for, but not restricted to, random access from disk. |
73
73
|**`S`**| Specifies that caching is optimized for, but not restricted to, sequential access from disk. |
74
74
|**`T`**| Specifies a file that isn't written to disk unless memory pressure requires it. |
@@ -80,6 +80,8 @@ Regarding `T` and `D`:
80
80
-`D` specifies a regular file that is written to disk. The difference is that it's automatically deleted when it's closed.
81
81
You can combine `TD` to get both semantics.
82
82
83
+
`_fsopen` and `_wfsopen` are Microsoft-specific variants of [`fopen`](fopen-wfopen.md). They aren't part of the ANSI standard. For a more portable and secure function, if you don't require file sharing, consider [`_wfopen_s` or `fopen_s`](fopen-s-wfopen-s.md).
84
+
83
85
The argument *`shflag`* is a constant expression consisting of one of the following manifest constants, defined in `Share.h`.
84
86
85
87
| Term | Definition |
@@ -89,7 +91,6 @@ The argument *`shflag`* is a constant expression consisting of one of the follow
89
91
|`_SH_DENYRW`| Denies read and write access to the file. |
90
92
|`_SH_DENYWR`| Denies write access to the file. |
91
93
92
-
`_fsopen` and `_wfsopen` are Microsoft-specific variants of [`fopen`](fopen-wfopen.md). They aren't part of the ANSI standard. For a more portable function, consider [`_wfopen_s` or `fopen_s`](fopen-s-wfopen-s.md).
93
94
94
95
By default, this function's global state is scoped to the application. To change this behavior, see [Global state in the CRT](../global-state.md).
0 commit comments