📄 cppio.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1st October 2002), see www.w3.org"> <title>C++ I/O</title> </head> <body bgcolor="#ffffff"> <table width="100%" bgcolor="#eeeeff"> <tr> <td><a href="index.html">cppreference.com</a> -> C++ I/O</td> </tr> </table> <h3>C++ I/O</h3> <p>The <iostream> library automatically defines a few standard objects:</p> <ul> <li><strong>cout</strong>, an object of the ostream class, which displays data to the standard output device.</li> <li><strong>cerr</strong>, another object of the ostream class that writes unbuffered output to the standard error device.</li> <li><strong>clog</strong>, like <strong>cerr</strong>, but uses buffered output.</li> <li><strong>cin</strong>, an object of the istream class that reads data from the standard input device.</li> </ul> <p>The <fstream> library allows programmers to do file input and output with the <strong>ifstream</strong> and <strong>ofstream</strong> classes.</p> <p>Some of the behavior of the C++ I/O streams (precision, justification, etc) may be modified by manipulating various <a href="cppio_flags.html">flags</a>.</p> <table> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#Constructors">Constructors</a></td> <td>Constructors</td> </tr> <tr> <td><a href="cppio_details.html#bad">bad()</a></td> <td>true if an error occurred</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#clear">clear()</a></td> <td>clear status flags</td> </tr> <tr> <td><a href="cppio_details.html#close">close()</a></td> <td>close a stream</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#eof">eof()</a></td> <td>true if at the end-of-file</td> </tr> <tr> <td><a href="cppio_details.html#fail">fail()</a></td> <td>true if an error occurred</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#fill">fill()</a></td> <td>manipulate the default fill character</td> </tr> <tr> <td><a href="cppio_details.html#flags">flags()</a></td> <td>manipulate flags</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#flush">flush()</a></td> <td>empty the buffer</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#gcount">gcount()</a></td> <td>number of characters read during last input</td> </tr> <tr> <td><a href="cppio_details.html#get">get()</a></td> <td>read characters</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#getline">getline()</a></td> <td>read a line of characters</td> </tr> <tr> <td><a href="cppio_details.html#good">good()</a></td> <td>true if no errors have occurred</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#ignore">ignore()</a></td> <td>read and discard characters</td> </tr> <tr> <td><a href="cppio_details.html#open">open()</a></td> <td>create an input stream</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#peek">peek()</a></td> <td>check the next input character</td> </tr> <tr> <td><a href="cppio_details.html#precision">precision()</a></td> <td>manipulate precision</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#put">put()</a></td> <td>write characters</td> </tr> <tr> <td><a href="cppio_details.html#putback">putback()</a></td> <td>return characters to a stream</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#rdstate">rdstate()</a></td> <td>returns the status of the stream</td> </tr> <tr> <td><a href="cppio_details.html#read">read()</a></td> <td>read characters</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#seekg">seekg()</a></td> <td>perform random access on a stream</td> </tr> <tr> <td><a href="cppio_details.html#seekp">seekp()</a></td> <td>perform random access on a stream</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#setf">setf()</a></td> <td>set format flags</td> </tr> <tr> <td><a href="cppio_details.html#sync_with_stdio">sync_with_stdio()</a></td> <td>synchronize with standard I/O</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#tellg">tellg()</a></td> <td>read stream pointers</td> </tr> <tr> <td><a href="cppio_details.html#tellp">tellp()</a></td> <td>read stream pointers</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#unsetf">unsetf()</a></td> <td>clear format flags</td> </tr> <tr> <td><a href="cppio_details.html#width">width()</a></td> <td>manipulate the field width</td> </tr> <tr bgcolor="#eeeeff"> <td><a href="cppio_details.html#write">write()</a></td> <td>write characters</td> </tr> </table> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -