⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 all.html

📁 从www.CppReference.com打包的C++参考手册
💻 HTML
📖 第 1 页 / 共 4 页
字号:
    <a href="printf.html">printf</a><br>    <a href="sprintf.html">sprintf</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fputc  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fputc( int ch, FILE *stream );</pre>  <p>The function fputc() writes the given character <em>ch</em> to the  given output <em>stream</em>. The return value is the character,  unless there is an error, in which case the return value is  <strong>EOF</strong>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetc.html">fgetc</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fprintf.html">fprintf</a><br>    <a href="fread.html">fread</a><br>    <a href="fwrite.html">fwrite</a><br>    <a href="getc.html">getc</a><br>    <a href="getchar.html">getchar</a><br>    <a href="putc.html">putc</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fputs  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fputs( const char *str, FILE *stream );</pre>  <p>The fputs() function writes an array of characters pointed to by  <em>str</em> to the given output <em>stream</em>. The return value is  non-negative on success, and <strong>EOF</strong> on failure.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgets.html">fgets</a><br>    <a href="fprintf.html">fprintf</a><br>    <a href="fscanf.html">fscanf</a><br>    <a href="gets.html">gets</a><br>    <a href="puts.html">puts</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fread  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fread( void *buffer, size_t size, size_t num, FILE *stream );</pre>  <p>The function fread() reads <em>num</em> number of objects (where  each object is <em>size</em> bytes) and places them into the array  pointed to by buffer. The data comes from the given input  <em>stream</em>. The return value of the function is the number of  things read. You can use <a href="feof.html">feof</a>() or <a href=  "ferror.html">ferror</a>() to figure out if an error occurs.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fflush.html">fflush</a><br>    <a href="fgetc.html">fgetc</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fputc.html">fputc</a><br>    <a href="fscanf.html">fscanf</a><br>    <a href="fwrite.html">fwrite</a><br>    <a href="getc.html">getc</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    freopen  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  FILE *freopen( const char *fname, const char *mode, FILE *stream );</pre>  <p>The freopen() function is used to reassign an existing  <em>stream</em> to a different file and mode. After a call to this  function, the given file <em>stream</em> will refer to <em>fname</em>  with access given by <em>mode</em>. The return value of freopen() is  the new stream, or <strong>NULL</strong> if there is an error.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fclose.html">fclose</a><br>    <a href="fopen.html">fopen</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fscanf  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fscanf( FILE *stream, const char *format, ... );</pre>  <p>The function fscanf() reads data from the given file  <em>stream</em> in a manner exactly like scanf(). The return value of  fscanf() is the number of variables that are actually assigned  values, or <strong>EOF</strong> if no assignments could be made.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgets.html">fgets</a><br>    <a href="fprintf.html">fprintf</a><br>    <a href="fputs.html">fputs</a><br>    <a href="fread.html">fread</a><br>    <a href="fwrite.html">fwrite</a><br>    <a href="scanf.html">scanf</a><br>    <a href="sscanf.html">sscanf</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fseek  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fseek( FILE *stream, long offset, int origin );</pre>  <p>The function fseek() sets the file position data for the given  <em>stream</em>. The origin value should have one of the following  values (defined in stdio.h):</p>  <table class="code-table">    <tr>      <th class="code-table-th">Name</th>      <th class="code-table-th">Explanation</th>    </tr>    <tr>      <td class="code-table-td">SEEK_SET</td>      <td class="code-table-td">Seek from the start of the file</td>    </tr>    <tr>      <td class="code-table-td">SEEK_CUR</td>      <td class="code-table-td">Seek from the current location</td>    </tr>    <tr>      <td class="code-table-td">SEEK_END</td>      <td class="code-table-td">Seek from the end of the file</td>    </tr>  </table>  <p>fseek() returns zero upon success, non-zero on failure. You can  use fseek() to move beyond a file, but not before the beginning.  Using fseek() clears the <strong>EOF</strong> flag associated with  that stream.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetpos.html">fgetpos</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fsetpos.html">fsetpos</a><br>    <a href="ftell.html">ftell</a><br>    <a href="rewind.html">rewind</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fsetpos  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fsetpos( FILE *stream, const fpos_t *position );</pre>  <p>The fsetpos() function moves the file position indicator for the  given <em>stream</em> to a location specified by the  <em>position</em> object. fpos_t is defined in stdio.h. The return  value for fsetpos() is zero upon success, non-zero on failure.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetpos.html">fgetpos</a><br>    <a href="fseek.html">fseek</a><br>    <a href="ftell.html">ftell</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    ftell  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  long ftell( FILE *stream );</pre>  <p>The ftell() function returns the current file position for  <em>stream</em>, or -1 if an error occurs.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetpos.html">fgetpos</a><br>    <a href="fseek.html">fseek</a><br>    <a href="fsetpos.html">fsetpos</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    fwrite  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int fwrite( const void *buffer, size_t size, size_t count, FILE *stream );</pre>  <p>The fwrite() function writes, from the array <em>buffer</em>,  <em>count</em> objects of size <em>size</em> to <em>stream</em>. The  return value is the number of objects written.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fflush.html">fflush</a><br>    <a href="fgetc.html">fgetc</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fputc.html">fputc</a><br>    <a href="fread.html">fread</a><br>    <a href="fscanf.html">fscanf</a><br>    <a href="getc.html">getc</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    getc  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int getc( FILE *stream );</pre>  <p>The getc() function returns the next character from  <em>stream</em>, or <strong>EOF</strong> if the end of file is  reached. getc() is identical to <a href="fgetc.html">fgetc</a>(). For  example:</p>  <pre class="example-code">   int ch;   FILE *input = fopen( &quot;stuff&quot;, &quot;r&quot; );                ch = getc( input );   while( ch != <strong>EOF</strong> ) {     printf( &quot;%c&quot;, ch );     ch = getc( input );   }            </pre>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="feof.html">feof</a><br>    <a href="fflush.html">fflush</a><br>    <a href="fgetc.html">fgetc</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fputc.html">fputc</a><br>    <a href="fread.html">fread</a><br>    <a href="fwrite.html">fwrite</a><br>    <a href="putc.html">putc</a><br>    <a href="ungetc.html">ungetc</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    getchar  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  int getchar( void );</pre>  <p>The getchar() function returns the next character from  <strong>stdin</strong>, or <strong>EOF</strong> if the end of file is  reached.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetc.html">fgetc</a><br>    <a href="fopen.html">fopen</a><br>    <a href="fputc.html">fputc</a><br>    <a href="putc.html">putc</a>  </div>  </div>  </td>    </tr>  </table></body></html><hr>  <div class="name-format">    gets  </div>  <div class="syntax-name-format">    Syntax:  </div>  <pre class="syntax-box">  #include &lt;stdio.h&gt;  char *gets( char *str );</pre>  <p>The gets() function reads characters from <strong>stdin</strong>  and loads them into <em>str</em>, until a newline or  <strong>EOF</strong> is reached. The newline character is translated  into a null termination. The return value of gets() is the read-in  string, or <strong>NULL</strong> if there is an error.</p>  <p>Note that gets() does not perform bounds checking, and thus risks  overrunning <em>str</em>.  For a similar (and safer) function that  includes bounds checking, see <a href="fgets.html">fgets()</a>.</p>  <div class="related-name-format">    Related topics:  </div>  <div class="related-content">    <a href="fgetc.html">fgetc</a><br>    <a href="fgets.html">fgets</a><br>    <a href="fputs.html">fputs</a><br>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -