📄 ignore.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>ignore</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">C++ I/O</a> > <a href="ignore.html">ignore</a> </div> <div class="name-format"> ignore </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <fstream> istream& ignore( streamsize num=1, int delim=<strong>EOF</strong> );</pre> <p>The ignore() function is used with input streams. It reads and throws away characters until <em>num</em> characters have been read (where <em>num</em> defaults to 1) or until the character <em>delim</em> is read (where <em>delim</em> defaults to <strong>EOF</strong>).</p> <p>The ignore() function can sometimes be useful when using the getline() function together with the >> operator. For example, if you read some input that is followed by a newline using the >> operator, the newline will remain in the input as the next thing to be read. Since getline() will by default stop reading input when it reaches a newline, a subsequent call to getline() will return an empty string. In this case, the ignore() function could be called before getline() to "throw away" the newline.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="get.html">get</a><br> <a href="getline.html">getline</a> </div> </div> </td> </tr> </table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -