📄 ansistdio.html
字号:
written to the file; any unread buffered data is discarded. The streamis disassociated from the file. If the associated buffer was allocatedautomatically, it is deallocated.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>Zero if the stream is closed successfully, or EOF if errors occur.<p></blockquote><h4>ERRNO</h4><blockquote><p>EBADF<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fflush">fflush</a>( )</b><hr><a name="fdopen"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fdopen( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fdopen( )</strong> - open a file specified by a file descriptor (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>FILE * fdopen ( int fd, /* file descriptor */ const char * mode /* mode to open with */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine opens the file specified by the file descriptor <i>fd</i> andassociates a stream with it.The <i>mode</i> argument is used just as in the <b><a href="./ansiStdio.html#fopen">fopen</a>( )</b> function.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p>A pointer to a stream, or a null pointer if an error occurs,with <b>errno</b> set to indicate the error.<p></blockquote><h4>ERRNO</h4><blockquote><p>EINVAL<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fopen">fopen</a>( )</b>, <b><a href="./ansiStdio.html#freopen">freopen</a>( )</b>, * .I "Information Technology - POSIX - Part 1:"<i>System API [C Language], IEEE Std 1003.1</i><hr><a name="feof"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>feof( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>feof( )</strong> - test the end-of-file indicator for a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int feof ( FILE * fp /* stream to test */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine tests the end-of-file indicator for a specified stream. <p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>Non-zero if the end-of-file indicator is set for <i>fp</i>.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#clearerr">clearerr</a>( )</b><hr><a name="ferror"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ferror( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ferror( )</strong> - test the error indicator for a file pointer (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int ferror ( FILE * fp /* stream to test */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine tests the error indicator for the stream pointed to by <i>fp</i>.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p>Non-zero if the error indicator is set for <i>fp</i>.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#clearerr">clearerr</a>( )</b><hr><a name="fflush"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fflush( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fflush( )</strong> - flush a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fflush ( FILE * fp /* stream to flush */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine writes to the file any unwritten data for a specified outputor update stream for which the most recent operation was not input; for aninput stream the behavior is undefined.<p></blockquote><h4>CAVEAT</h4><blockquote><p>ANSI specifies that if <i>fp</i> is a null pointer, <b><a href="./ansiStdio.html#fflush">fflush</a>( )</b> performs theflushing action on all streams for which the behavior is defined; however,this is not implemented in VxWorks.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p>Zero, or EOF if a write error occurs.<p></blockquote><h4>ERRNO</h4><blockquote><p>EBADF<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fclose">fclose</a>( )</b><hr><a name="fgetc"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fgetc( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fgetc( )</strong> - return the next character from a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fgetc ( FILE * fp /* stream to read from */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the next character (converted to an <b>int</b>) from thespecified stream, and advances the file position indicator for the stream.<p>If the stream is at end-of-file, the end-of-file indicator for the stream isset; if a read error occurs, the error indicator is set.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>The next character from the stream, or EOF if the stream is at end-of-fileor a read error occurs.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fgets">fgets</a>( )</b>, <b><a href="./ansiStdio.html#getc">getc</a>( )</b><hr><a name="fgetpos"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fgetpos( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fgetpos( )</strong> - store the current value of the file position indicator for a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fgetpos ( FILE * fp, /* stream */ fpos_t * pos /* where to store position */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine stores the current value of the file position indicator for aspecified stream <i>fp</i> in the object pointed to by <i>pos</i>. The value storedcontains unspecified information usable by <b><a href="./ansiStdio.html#fsetpos">fsetpos</a>( )</b> for repositioningthe stream to its position at the time <b><a href="./ansiStdio.html#fgetpos">fgetpos</a>( )</b> was called.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>Zero, or non-zero if unsuccessful, with <b>errno</b> set to indicate the error.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fsetpos">fsetpos</a>( )</b><hr><a name="fgets"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fgets( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fgets( )</strong> - read a specified number of characters from a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>char * fgets ( char * buf, /* where to store characters */ size_t n, /* no. of bytes to read + 1 */ FILE * fp /* stream to read from */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine stores in the array <i>buf</i> up to <i>n</i>-1 characters from aspecified stream. No additional characters are read after a new-line orend-of-line. A null character is written immediately after the lastcharacter read into the array.<p>If end-of-file is encountered and no characters have been read, thecontents of the array remain unchanged. If a read error occurs, the arraycontents are indeterminate.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>A pointer to <i>buf</i>, or a null pointer if an error occurs or end-of-file isencountered and no characters have been read.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#fread">fread</a>( )</b>, <b><a href="./ansiStdio.html#fgetc">fgetc</a>( )</b><hr><a name="fileno"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fileno( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fileno( )</strong> - return the file descriptor for a stream (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fileno ( FILE * fp /* stream */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the file descriptor associated with a specifiedstream.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>The file descriptor, or -1 if an error occurs, with <b>errno</b> set to indicatethe error.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, * .I "Information Technology - POSIX - Part 1:"<i>System API [C Language], IEEE Std 1003.1</i><hr><a name="fopen"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fopen( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fopen( )</strong> - open a file specified by name (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>FILE * fopen ( const char * file, /* name of file */ const char * mode /* mode */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -