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/mfc/reference/carchive-class.md
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -610,9 +610,9 @@ In the version that returns an `LPTSTR`, a pointer to the buffer containing the
610
610
611
611
### Remarks
612
612
613
-
In the version of the member function with the *nMax* parameter, the buffer will hold up to a limit of *nMax* - 1 characters. Reading is stopped by a carriage return-linefeed pair. Trailing newline characters are always removed. A null character ('\0') is appended in either case.
613
+
In the version of the member function with the *nMax* parameter, the buffer will hold up to a limit of *nMax* - 1 characters. Reading is stopped by a carriage return-line feed pair. Trailing newline characters are always removed. A null character ('\0') is appended in either case.
614
614
615
-
[CArchive::Read](#read) is also available for text-mode input, but it does not terminate on a carriage return-linefeed pair.
615
+
[CArchive::Read](#read) is also available for text-mode input, but it does not terminate on a carriage return-line feed pair.
Copy file name to clipboardExpand all lines: docs/mfc/reference/cedit-class.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -348,7 +348,7 @@ Nonzero if any formatting occurs; otherwise 0.
348
348
349
349
### Remarks
350
350
351
-
A soft line break consists of two carriage returns and a linefeed inserted at the end of a line that is broken because of word wrapping. A hard line break consists of one carriage return and a linefeed. Lines that end with a hard line break are not affected by `FmtLines`.
351
+
A soft line break consists of two carriage returns and a line feed inserted at the end of a line that is broken because of word wrapping. A hard line break consists of one carriage return and a line feed. Lines that end with a hard line break are not affected by `FmtLines`.
352
352
353
353
Windows will only respond if the `CEdit` object is a multiple-line edit control.
Copy file name to clipboardExpand all lines: docs/mfc/reference/cfile-class.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -162,7 +162,7 @@ Choose one of the following character mode options.
162
162
|Value|Description|
163
163
|-----------|-----------------|
164
164
|`CFile::typeBinary`|Sets binary mode (used in derived classes only).|
165
-
|`CFile::typeText`|Sets text mode with special processing for carriage return-linefeed pairs (used in derived classes only).|
165
+
|`CFile::typeText`|Sets text mode with special processing for carriage return-line feed pairs (used in derived classes only).|
166
166
|`CFile::typeUnicode`|Sets Unicode mode (used in derived classes only). Text is written to the file in Unicode format when the application is built in a Unicode configuration. No BOM is written to the file.|
167
167
168
168
Choose only one of the following file share mode options. The default file share mode is `CFile::shareExclusive`, which is exclusive.
@@ -573,7 +573,7 @@ virtual UINT Read(
573
573
Pointer to the user-supplied buffer that is to receive the data read from the file.
574
574
575
575
*nCount*<br/>
576
-
The maximum number of bytes to be read from the file. For text-mode files, carriage return-linefeed pairs are counted as single characters.
576
+
The maximum number of bytes to be read from the file. For text-mode files, carriage return-line feed pairs are counted as single characters.
577
577
578
578
### Return Value
579
579
@@ -842,7 +842,7 @@ virtual void Write(
842
842
A pointer to the user-supplied buffer that contains the data to be written to the file.
843
843
844
844
*nCount*<br/>
845
-
The number of bytes to be transferred from the buffer. For text-mode files, carriage return-linefeed pairs are counted as single characters.
845
+
The number of bytes to be transferred from the buffer. For text-mode files, carriage return-line feed pairs are counted as single characters.
Copy file name to clipboardExpand all lines: docs/mfc/reference/cstdiofile-class.md
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ class CStdioFile : public CFile
42
42
43
43
Stream files are buffered and can be opened in either text mode (the default) or binary mode.
44
44
45
-
Text mode provides special processing for carriage return-linefeed pairs. When you write a newline character (0x0A) to a text-mode `CStdioFile` object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0D, 0x0A) is translated to a single 0x0A byte.
45
+
Text mode provides special processing for carriage return-line feed pairs. When you write a line feed (newline) character (0x0A) to a text-mode `CStdioFile` object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0D, 0x0A) is translated to a single 0x0A byte.
46
46
47
47
The [CFile](../../mfc/reference/cfile-class.md) functions [Duplicate](../../mfc/reference/cfile-class.md#duplicate), [LockRange](../../mfc/reference/cfile-class.md#lockrange), and [UnlockRange](../../mfc/reference/cfile-class.md#unlockrange) are not supported for `CStdioFile`.
48
48
@@ -193,7 +193,7 @@ A pointer to the buffer containing the text data. NULL if end-of-file was reache
193
193
194
194
Reading is stopped by the first newline character. If, in that case, fewer than *nMax*-1 characters have been read, a newline character is stored in the buffer. A null character ('\0') is appended in either case.
195
195
196
-
[CFile::Read](../../mfc/reference/cfile-class.md#read) is also available for text-mode input, but it does not terminate on a carriage return-linefeed pair.
196
+
[CFile::Read](../../mfc/reference/cfile-class.md#read) is also available for text-mode input, but it does not terminate on a carriage return-line feed pair.
197
197
198
198
> [!NOTE]
199
199
> The `CString` version of this function removes the `'\n'` if present; the LPTSTR version does not.
@@ -259,7 +259,7 @@ Specifies a pointer to a buffer that contains a null-terminated string.
259
259
260
260
### Remarks
261
261
262
-
The terminating null character ( `\0`) is not written to the file. This method writes newline characters in *lpsz* to the file as a carriage return/linefeed pair.
262
+
The terminating null character ( `\0`) is not written to the file. This method writes newline characters in *lpsz* to the file as a carriage return-line feed pair.
263
263
264
264
If you want to write data that is not null-terminated to a file, use `CStdioFile::Write` or [CFile::Write](../../mfc/reference/cfile-class.md#write).
Streams were originally designed for text, so the default output mode is text. In text mode, the newline character (hexadecimal 10) expands to a carriage return-linefeed (16-bit only). The expansion can cause problems, as shown here:
9
+
Streams were originally designed for text, so the default output mode is text. In text mode, the line feed (newline) character expands to a carriage return-line feed pair. The expansion can cause problems, as shown here:
10
10
11
11
```cpp
12
12
// binary_output_files.cpp
@@ -21,7 +21,7 @@ int main( )
21
21
}
22
22
```
23
23
24
-
You might expect this program to output the byte sequence { 99, 0, 10, 0 }; instead, it outputs { 99, 0, 13, 10, 0 }, which causes problems for a program expecting binary input. If you need true binary output, in which characters are written untranslated, you could specify binary output by using the [ofstream](../standard-library/basic-ofstream-class.md#basic_ofstream) constructor openmode argument:
24
+
You might expect this program to output the byte sequence { 99, 0, 10, 0 }; instead, it outputs { 99, 0, 13, 10, 0 }, which causes problems for a program expecting binary input. If you need true binary output, in which characters are written untranslated, you could specify binary output by using the [ofstream](../standard-library/basic-ofstream-class.md#basic_ofstream) constructor `openmode` argument:
Copy file name to clipboardExpand all lines: docs/standard-library/effects-of-buffering.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ To make the program work logically, the `cout` object must empty itself when the
31
31
cout <<"Please wait..." <<flush;
32
32
```
33
33
34
-
This step flushes the buffer, ensuring the message prints before the wait. You can also use the `endl` manipulator, which flushes the buffer and outputs a carriage return-linefeed, or you can use the `cin` object. This object (with the `cerr` or `clog` objects) is usually tied to the `cout` object. Thus, any use of `cin` (or of the `cerr` or `clog` objects) flushes the `cout` object.
34
+
This step flushes the buffer, ensuring the message prints before the wait. You can also use the `endl` manipulator, which flushes the buffer and outputs a carriage return-line feed, or you can use the `cin` object. This object (with the `cerr` or `clog` objects) is usually tied to the `cout` object. Thus, any use of `cin` (or of the `cerr` or `clog` objects) flushes the `cout` object.
Copy file name to clipboardExpand all lines: docs/standard-library/input-stream-member-functions.md
+12-24Lines changed: 12 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,18 @@
1
1
---
2
2
title: "Input Stream Member Functions"
3
-
ms.date: "11/04/2016"
3
+
ms.date: "07/19/2019"
4
4
helpviewer_keywords: ["input stream objects", "input streams, member functions"]
5
5
ms.assetid: b4b9465d-0da9-4ccf-859d-72a68418982e
6
6
---
7
7
# Input Stream Member Functions
8
8
9
-
Input stream member functions are used for disk input. The member functions include:
9
+
Input stream member functions are used for disk input.
10
10
11
-
-[The open Function for Input Streams](#vclrftheopenfunctionforinputstreamsanchor11)
11
+
## <aname="vclrftheopenfunctionforinputstreamsanchor11"></a> open
12
12
13
-
-[The get](#vclrfthegetfunctionanchor12)
13
+
If you are using an input file stream (`ifstream`), you must associate that stream with a specific disk file. You can do this in the constructor, or you can use the `open` function. In either case, the arguments are the same.
14
14
15
-
-[The getline](#vclrfthegetlinefunctionanchor13)
16
-
17
-
-[The read](#vclrfthereadfunctionanchor14)
18
-
19
-
-[The seekg and tellg Functions](#vclrftheseekgandtellgfunctionsanchor7)
20
-
21
-
-[The close Function for Input Streams](#vclrftheclosefunctionforinputstreamsanchor15)
22
-
23
-
## <aname="vclrftheopenfunctionforinputstreamsanchor11"></a> The open Function for Input Streams
24
-
25
-
If you are using an input file stream (ifstream), you must associate that stream with a specific disk file. You can do this in the constructor, or you can use the `open` function. In either case, the arguments are the same.
26
-
27
-
You generally specify an [ios_base::openmode](../standard-library/ios-base-class.md#openmode) flag when you open the file associated with an input stream (the default mode is `ios::in`). For a list of the `open_mode` flags, see [The open](#vclrftheopenfunctionforinputstreamsanchor11). The flags can be combined with the bitwise OR ( | ) operator.
15
+
You generally specify an [ios_base::openmode](../standard-library/ios-base-class.md#openmode) flag when you open the file associated with an input stream (the default mode is `ios::in`). For a list of the `openmode` flags, see [ios_base::openmode](../standard-library/ios-base-class.md#openmode). The flags can be combined with the bitwise OR ( | ) operator.
28
16
29
17
To read a file, first use the `fail` member function to determine whether it exists:
30
18
@@ -35,7 +23,7 @@ if (ifile.fail())
35
23
// The file does not exist ...
36
24
```
37
25
38
-
## <a name="vclrfthegetfunctionanchor12"></a> The get
26
+
## <a name="vclrfthegetfunctionanchor12"></a> get
39
27
40
28
The unformatted `get` member function works like the `>>` operator with two exceptions. First, the `get` function includes white-space characters, whereas the extractor excludes white space when the `skipws` flag is set (the default). Second, the `get` function is less likely to cause a tied output stream (`cout`, for example) to be flushed.
41
29
@@ -70,7 +58,7 @@ int main()
70
58
1234
71
59
```
72
60
73
-
## <aname="vclrfthegetlinefunctionanchor13"></a> The getline
The `getline` member function is similar to the `get` function. Both functions allow a third argument that specifies the terminating character for input. The default value is the newline character. Both functions reserve one character for the required terminating character. However, `get` leaves the terminating character in the stream and `getline` removes the terminating character.
76
64
@@ -97,7 +85,7 @@ int main( )
97
85
test
98
86
```
99
87
100
-
## <aname="vclrfthereadfunctionanchor14"></a> The read
The `read` member function reads bytes from a file to a specified area of memory. The length argument determines the number of bytes read. If you do not include that argument, reading stops when the physical end of file is reached or, in the case of a text-mode file, when an embedded `EOF` character is read.
103
91
@@ -127,9 +115,9 @@ int main()
127
115
}
128
116
```
129
117
130
-
The program assumes that the data records are formatted exactly as specified by the structure with no terminating carriage-return or linefeed characters.
118
+
The program assumes that the data records are formatted exactly as specified by the structure with no terminating carriagereturn or line feed characters.
131
119
132
-
## <aname="vclrftheseekgandtellgfunctionsanchor7"></a> The seekg and tellg Functions
120
+
## <aname="vclrftheseekgandtellgfunctionsanchor7"></a> seekg and tellg
133
121
134
122
Input file streams keep an internal pointer to the position in the file where data is to be read next. You set this pointer with the `seekg` function, as shown here:
135
123
@@ -184,9 +172,9 @@ int main( )
184
172
}
185
173
```
186
174
187
-
## <aname="vclrftheclosefunctionforinputstreamsanchor15"></a> The close Function for Input Streams
175
+
## <aname="vclrftheclosefunctionforinputstreamsanchor15"></a> close
188
176
189
-
The `close` member function closes the disk file associated with an input file stream and frees the operating system file handle. The [ifstream](../standard-library/basic-ifstream-class.md) destructor closes the file for you, but you can use the `close` function if you need to open another file for the same stream object.
177
+
The `close` member function closes the disk file associated with an input file stream and frees the operating system file handle. The [`ifstream`](../standard-library/basic-ifstream-class.md) destructor closes the file for you, but you can use the `close` function if you need to open another file for the same stream object.
0 commit comments