Skip to content

Commit 891c21c

Browse files
author
Colin Robertson
committed
Acrolinx
1 parent 8a8c76f commit 891c21c

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

docs/standard-library/binary-output-files.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main( )
2121
}
2222
```
2323
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:
2525
2626
```cpp
2727
// binary_output_files2.cpp
@@ -41,4 +41,4 @@ int main()
4141

4242
## See also
4343

44-
[Output Streams](../standard-library/output-streams.md)<br/>
44+
[Output Streams](../standard-library/output-streams.md)

docs/standard-library/input-stream-member-functions.md

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,13 @@ ms.assetid: b4b9465d-0da9-4ccf-859d-72a68418982e
66
---
77
# Input Stream Member Functions
88

9-
Input stream member functions are used for disk input. The member functions include:
9+
Input stream member functions are used for disk input.
1010

11-
- [The open Function for Input Streams](#vclrftheopenfunctionforinputstreamsanchor11)
11+
## <a name="vclrftheopenfunctionforinputstreamsanchor11"></a> open
1212

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.
1414

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-
## <a name="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 ( &#124; ) 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 ( &#124; ) operator.
2816

2917
To read a file, first use the `fail` member function to determine whether it exists:
3018

@@ -35,7 +23,7 @@ if (ifile.fail())
3523
// The file does not exist ...
3624
```
3725
38-
## <a name="vclrfthegetfunctionanchor12"></a> The get
26+
## <a name="vclrfthegetfunctionanchor12"></a> get
3927
4028
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.
4129
@@ -70,7 +58,7 @@ int main()
7058
1234
7159
```
7260

73-
## <a name="vclrfthegetlinefunctionanchor13"></a> The getline
61+
## <a name="vclrfthegetlinefunctionanchor13"></a> getline
7462

7563
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.
7664

@@ -97,7 +85,7 @@ int main( )
9785
test
9886
```
9987

100-
## <a name="vclrfthereadfunctionanchor14"></a> The read
88+
## <a name="vclrfthereadfunctionanchor14"></a> read
10189

10290
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.
10391

@@ -129,7 +117,7 @@ int main()
129117

130118
The program assumes that the data records are formatted exactly as specified by the structure with no terminating carriage return or line feed characters.
131119

132-
## <a name="vclrftheseekgandtellgfunctionsanchor7"></a> The seekg and tellg Functions
120+
## <a name="vclrftheseekgandtellgfunctionsanchor7"></a> seekg and tellg
133121

134122
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:
135123

@@ -184,9 +172,9 @@ int main( )
184172
}
185173
```
186174

187-
## <a name="vclrftheclosefunctionforinputstreamsanchor15"></a> The close Function for Input Streams
175+
## <a name="vclrftheclosefunctionforinputstreamsanchor15"></a> close
188176

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.
190178

191179
## See also
192180

0 commit comments

Comments
 (0)