📄 ansistdio.html
字号:
received a conversion result. If this object does not have an appropriatetype, or if the result of the conversion cannot be represented in thespace provided, the behavior is undefined.<p>The following conversion specifiers are valid:<p><dl><dt><b>d</b><dd>Matches an optionally signed decimal integer whose format isthe same as expected for the subject sequence of the <b><a href="./ansiStdlib.html#strtol">strtol</a>( )</b>function with the value 10 for the <i>base</i> argument. The corresponding argument should be a pointer to <b>int</b>.<dt><b>i</b><dd>Matches an optionally signed integer, whose format is thesame as expected for the subject sequence of the <b><a href="./ansiStdlib.html#strtol">strtol</a>( )</b>function with the value 0 for the <i>base</i> argument. The corresponding argument should be a pointer to <b>int</b>.<dt><b>o</b><dd>Matches an optionally signed octal integer, whose format is thesame as expected for the subject sequence of the <b><a href="./ansiStdlib.html#strtoul">strtoul</a>( )</b>function with the value 8 for the <i>base</i> argument. Thecorresponding argument should be a pointer to <b>unsigned int</b>.<dt><b>u</b><dd>Matches an optionally signed decimal integer, whose format is the same as expected for the subject sequence of the <b><a href="./ansiStdlib.html#strtoul">strtoul</a>( )</b>function with the value 10 for the <i>base</i> argument. Thecorresponding argument should be a pointer to <b>unsigned int</b>.<dt><b>x</b><dd>Matches an optionally signed hexadecimal integer, whose format isthe same as expected for the subject sequence of the <b><a href="./ansiStdlib.html#strtoul">strtoul</a>( )</b>function with the value 16 for the <i>base</i> argument. Thecorresponding argument should be a pointer to <b>unsigned int</b>.<dt><b>e</b>, <b>f</b>, <b>g</b><dd>Match an optionally signed floating-point number, whose formatis the same as expected for the subject string of the <b><a href="./ansiStdlib.html#strtod">strtod</a>( )</b>function. The corresponding argument should be a pointer to <b>float</b>.<dt><b>s</b><dd>Matches a sequence of non-white-space characters. The corresponding argument should be a pointer to the initialcharacter of an array large enough to accept the sequenceand a terminating null character, which will be added automatically.<dt><b>[</b><dd>Matches a non-empty sequence of characters from a set of expected characters (the <b>scanset</b>). The corresponding argumentshould be a pointer to the initial character of an array largeenough to accept the sequence and a terminating null character,which is added automatically. The conversion specifierincludes all subsequent character in the format string, up toand including the matching right bracket (<b>]</b>). The charactersbetween the brackets (the <b>scanlist</b>) comprise the scanset,unless the character after the left bracket is a circumflex (<b>^</b>)in which case the scanset contains all characters that do notappear in the scanlist between the circumflex and the rightbracket. If the conversion specifier begins with "[]" or "[^]", theright bracket character is in the scanlist and the next right bracket character is the matching right bracket that endsthe specification; otherwise the first right bracket characteris the one that ends the specification.<dt><b>c</b><dd>Matches a sequence of characters of the number specified by thefield width (1 if no field width is present in the directive).The corresponding argument should be a pointer to the initial character of an array large enough to accept the sequence.No null character is added.<dt><b>p</b><dd>Matches an implementation-defined set of sequences, which should bethe same as the set of sequences that may be produced by the %pconversion of the <b><a href="./ansiStdio.html#fprintf">fprintf</a>( )</b> function. The corresponding argumentshould be a pointer to a pointer to <b>void</b>. VxWorks defines itspointer input field to be consistent with pointers written by the<b><a href="./ansiStdio.html#fprintf">fprintf</a>( )</b> function ("0x" hexadecimal notation). If the input item isa value converted earlier during the same program execution, thepointer that results should compare equal to that value; otherwisethe behavior of the %p conversion is undefined.<dt><b>n</b><dd>No input is consumed. The corresponding argument should be a pointer to<b>int</b> into which the number of characters read from the input stream sofar by this call to <b><a href="./ansiStdio.html#fscanf">fscanf</a>( )</b> is written. Execution of a %n directive doesnot increment the assignment count returned when <b><a href="./ansiStdio.html#fscanf">fscanf</a>( )</b> completesexecution.<dt><b>%</b><dd>Matches a single <b>%</b>; no conversion or assignment occurs. Thecomplete conversion specification is %%.</dl><p>If a conversion specification is invalid, the behavior is undefined.<p>The conversion specifiers <b>E</b>, <b>G</b>, and <b>X</b> are also valid and behave thesame as <b>e</b>, <b>g</b>, and <b>x</b>, respectively.<p>If end-of-file is encountered during input, conversion is terminated. If end-of-file occurs before any characters matching the current directivehave been read (other than leading white space, where permitted), executionof the current directive terminates with an input failure; otherwise, unlessexecution of the current directive is terminated with a matching failure,execution of the following directive (if any) is terminated with an inputfailure.<p>If conversion terminates on a conflicting input character, the offendinginput character is left unread in the input stream. Trailing white space(including new-line characters) is left unread unless matched by adirective. The success of literal matches and suppressed assignments isnot directly determinable other than via the %n directive.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>The number of input items assigned, which can be fewer than provided for,or even zero, in the event of an early matching failure; or EOF if aninput failure occurs before any conversion.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ansiStdio.html#top">ansiStdio</a></b>, <b><a href="./ansiStdio.html#scanf">scanf</a>( )</b>, <b><a href="./fioLib.html#sscanf">sscanf</a>( )</b><hr><a name="fseek"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fseek( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fseek( )</strong> - set the file position indicator for a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fseek ( FILE * fp, /* stream */ long offset, /* offset from <i>whence</i> */ int whence /* position to offset from: SEEK_SET = */ /* beginning SEEK_CUR = current position */ /* SEEK_END = end-of-file */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the file position indicator for a specified stream.For a binary stream, the new position, measured in characters from the beginning of the file, is obtained by adding <i>offset</i> to the position specified by <i>whence</i>, whose possible values are:<dl><dt><b>SEEK_SET</b><dd>the beginning of the file.<dt><b>SEEK_CUR</b><dd>the current value of the file position indicator.<dt><b>SEEK_END</b><dd>the end of the file.</dl>A binary stream does not meaningfullysupport <b><a href="./ansiStdio.html#fseek">fseek</a>( )</b> calls with a <i>whence</i> value of <b>SEEK_END</b>.<p>For a text stream, either <i>offset</i> is zero, or <i>offset</i> is a valuereturned by an earlier call to <b><a href="./ansiStdio.html#ftell">ftell</a>( )</b> on the stream, in which case<i>whence</i> should be <b>SEEK_SET</b>.<p>A successful call to <b><a href="./ansiStdio.html#fseek">fseek</a>( )</b> clears the end-of-file indicator for thestream and undoes any effects of <b><a href="./ansiStdio.html#ungetc">ungetc</a>( )</b> on the same stream. After an<b><a href="./ansiStdio.html#fseek">fseek</a>( )</b> call, the next operation on an update stream can be either inputor output.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p>Non-zero only for a request that cannot be satisfied.<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#ftell">ftell</a>( )</b><hr><a name="fsetpos"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fsetpos( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fsetpos( )</strong> - set the file position indicator for a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fsetpos ( FILE * iop, /* stream */ const fpos_t * pos /* position, obtained by fgetpos() */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine sets the file position indicator for a specified stream <i>iop</i>according to the value of the object pointed to by <i>pos</i>, which is a valueobtained from an earlier call to <b><a href="./ansiStdio.html#fgetpos">fgetpos</a>( )</b> on the same stream.<p>A successful call to <b><a href="./ansiStdio.html#fsetpos">fsetpos</a>( )</b> clears the end-of-file indicator for thestream and undoes any effects of <b><a href="./ansiStdio.html#ungetc">ungetc</a>( )</b> on the same stream. After an<b><a href="./ansiStdio.html#fsetpos">fsetpos</a>( )</b> call, the next operation on an update stream may be either inputor output.<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 the call fails, 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#fgetpos">fgetpos</a>( )</b><hr><a name="ftell"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>ftell( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>ftell( )</strong> - return the current value of the file position indicator for a stream (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>long ftell ( FILE * fp /* stream */ )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine returns the current value of the file position indicator fora specified stream. For a binary stream, the value is the number ofcharacters from the beginning of the file. For a text stream, the fileposition indicator contains unspecified information, usable by <b><a href="./ansiStdio.html#fseek">fseek</a>( )</b> forreturning the file position indicator to its position at the time of the<b><a href="./ansiStdio.html#ftell">ftell</a>( )</b> call; the difference between two such return values is notnecessary a meaningful measure of the number of characters written or read.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>stdio.h</b> <p></blockquote><h4>RETURNS</h4><blockquote><p><p>The current value of the file position indicator,or -1L 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#fseek">fseek</a>( )</b><hr><a name="fwrite"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries : Routines</i></a></p></blockquote><h1>fwrite( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong>fwrite( )</strong> - write from a specified array (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int fwrite ( const void * buf, /* where to copy from */ size_t size, /* element size */ size_t count, /* no. of elements */ FILE * fp /* stream to write to */ )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -