fsetpos.html

来自「posix标准英文,html格式」· HTML 代码 · 共 220 行

HTML
220
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>fsetpos</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="fsetpos"></a> <a name="tag_03_192"></a><!-- fsetpos --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_03_192_01"></a>NAME</h4><blockquote>fsetpos - set current file position</blockquote><h4><a name="tag_03_192_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><code><tt>#include &lt;<a href="../basedefs/stdio.h.html">stdio.h</a>&gt;<br><br> int fsetpos(FILE *</tt><i>stream</i><tt>, const fpos_t *</tt><i>pos</i><tt>);<br></tt></code></p></blockquote><h4><a name="tag_03_192_03"></a>DESCRIPTION</h4><blockquote><div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"border="0"> The functionality described on this reference page is aligned with the ISO&nbsp;C standard. Any conflict between therequirements described here and the ISO&nbsp;C standard is unintentional. This volume of IEEE&nbsp;Std&nbsp;1003.1-2001 defers tothe ISO&nbsp;C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div><p>The <i>fsetpos</i>() function shall set the file position and state indicators for the stream pointed to by <i>stream</i>according to the value of the object pointed to by <i>pos</i>, which the application shall ensure is a value obtained from anearlier call to <a href="../functions/fgetpos.html"><i>fgetpos</i>()</a> on the same stream. If a read or write error occurs, theerror indicator for the stream shall be set and <i>fsetpos</i>() fails.</p><p>A successful call to the <i>fsetpos</i>() function shall clear the end-of-file indicator for the stream and undo any effects of<a href="../functions/ungetc.html"><i>ungetc</i>()</a> on the same stream. After an <i>fsetpos</i>() call, the next operation on anupdate stream may be either input or output.</p><p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Thebehavior of <i>fsetpos</i>() on devices which are incapable of seeking is implementation-defined. The value of the file offsetassociated with such a device is undefined. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_192_04"></a>RETURN VALUE</h4><blockquote><p>The <i>fsetpos</i>() function shall return 0 if it succeeds; otherwise, it shall return a non-zero value and set <i>errno</i> toindicate the error.</p></blockquote><h4><a name="tag_03_192_05"></a>ERRORS</h4><blockquote><p>The <i>fsetpos</i>() function shall fail if, <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> &nbsp;either the <i>stream</i> is unbuffered or the <i>stream</i>'sbuffer needed to be flushed, and the call to <i>fsetpos</i>() causes an underlying <a href="../functions/lseek.html"><i>lseek</i>()</a> or <a href="../functions/write.html"><i>write</i>()</a> to be invoked, and: <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><dl compact><dt>[EAGAIN]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The O_NONBLOCK flag is set for the file descriptor and the thread would be delayed in the write operation. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EBADF]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The file descriptor underlying the stream file is not open for writing or the stream's buffer needed to be flushed and the file isnot open. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EFBIG]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Anattempt was made to write a file that exceeds the maximum file size. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EFBIG]</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">An attempt was made to write a file that exceeds the process' file size limit. <img src="../images/opt-end.gif" alt="[Option End]"border="0"></dd><dt>[EFBIG]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The file is a regular file and an attempt was made to write at or beyond the offset maximum associated with the correspondingstream. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EINTR]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The write operation was terminated due to the receipt of a signal, and no data was transferred. <img src="../images/opt-end.gif"alt="[Option End]" border="0"></dd><dt>[EIO]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Aphysical I/O error has occurred, or the process is a member of a background process group attempting to perform a <a href="../functions/write.html"><i>write</i>()</a> to its controlling terminal, TOSTOP is set, the process is neither ignoring norblocking SIGTTOU, and the process group of the process is orphaned. This error may also be returned under implementation-definedconditions. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[ENOSPC]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">There was no free space remaining on the device containing the file. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[ENXIO]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Arequest was made of a nonexistent device, or the request was outside the capabilities of the device. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EPIPE]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">The file descriptor underlying <i>stream</i> is associated with a pipe or FIFO. <img src="../images/opt-end.gif" alt="[Option End]"border="0"></dd><dt>[EPIPE]</dt><dd><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> Anattempt was made to write to a pipe or FIFO that is not open for reading by any process; a SIGPIPE signal shall also be sent to thethread. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_192_06"></a>EXAMPLES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_192_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_192_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_192_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_192_10"></a>SEE ALSO</h4><blockquote><p><a href="fopen.html"><i>fopen</i>()</a>, <a href="ftell.html"><i>ftell</i>()</a>, <a href="lseek.html"><i>lseek</i>()</a>, <ahref="rewind.html"><i>rewind</i>()</a>, <a href="ungetc.html"><i>ungetc</i>()</a>, <a href="write.html"><i>write</i>()</a>, theBase Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/stdio.h.html"><i>&lt;stdio.h&gt;</i></a></p></blockquote><h4><a name="tag_03_192_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4. Derived from the ISO&nbsp;C standard.</p></blockquote><h4><a name="tag_03_192_12"></a>Issue 6</h4><blockquote><p>Extensions beyond the ISO&nbsp;C standard are marked.</p><p>An additional [ESPIPE] error condition is added for sockets.</p><p>The DESCRIPTION is updated to avoid use of the term &quot;must&quot; for application requirements.</p><p>The DESCRIPTION is updated to clarify that the error indicator is set for the stream on a read or write error. This is foralignment with the ISO/IEC&nbsp;9899:1999 standard.</p><p>IEEE&nbsp;Std 1003.1-2001/Cor&nbsp;1-2002, item XSH/TC1/D6/21 is applied, deleting an erroneous [EINVAL] error case from theERRORS section.</p><p>IEEE&nbsp;Std&nbsp;1003.1-2001/Cor&nbsp;2-2004, item XSH/TC2/D6/43 is applied, updating the [EAGAIN] error in the ERRORS sectionfrom &quot;the process would be delayed&quot; to &quot;the thread would be delayed&quot;.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX &reg; is a registered Trademark of The Open Group.<br>POSIX &reg; is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>

⌨️ 快捷键说明

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