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

📄 function.dio-seek.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Seeks to pos on fd from whence</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dio-read.html">dio_read</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dio-stat.html">dio_stat</a></div> <div class="up"><a href="ref.dio.html">Direct IO Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.dio-seek" class="refentry"> <div class="refnamediv">  <h1 class="refname">dio_seek</h1>  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5 &lt;= 5.0.5)</p><p class="refpurpose"><span class="refname">dio_seek</span> &mdash; <span class="dc-title">Seeks to pos on fd from whence</span></p> </div> <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">int</span> <span class="methodname"><b><b>dio_seek</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$fd</tt></span>   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$pos</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$whence</tt></span>  ] )</div>  <p class="para rdfs-comment">   The function <b>dio_seek()</b> is used to change the   file position of the given file descriptor.    </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">fd</tt></i></span>     <dd>      <p class="para">       The file descriptor returned by <a href="function.dio-open.html" class="function">dio_open()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">pos</tt></i></span>     <dd>      <p class="para">       The new position.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">whence</tt></i></span>     <dd>      <p class="para">       Specifies how the position <i><tt class="parameter">pos</tt></i> should be        interpreted:       <ul class="itemizedlist">        <li class="listitem">         <p class="para">          <b><tt>SEEK_SET</tt></b> (default) - specifies that           <i><tt class="parameter">pos</tt></i> is specified from the beginning of the           file.         </p>        </li>        <li class="listitem">         <p class="para">          <b><tt>SEEK_CUR</tt></b> - Specifies that           <i><tt class="parameter">pos</tt></i> is a count of characters from the current          file position. This count may be positive or negative.         </p>        </li>        <li class="listitem">         <p class="para">          <b><tt>SEEK_END</tt></b> - Specifies that           <i><tt class="parameter">pos</tt></i> is a count of characters from the end of          the file. A negative count specifies a position within the current           extent of the file; a positive count specifies a position past the           current end. If you set the position past the current end, and           actually write data, you will extend the file with zeros up to that          position.         </p>        </li>       </ul>      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 Positioning in a file</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$fd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">dio_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'/dev/ttyS0'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">O_RDWR</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">dio_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SEEK_SET</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;position&nbsp;is&nbsp;now&nbsp;at&nbsp;10&nbsp;characters&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;file<br /><br /></span><span style="color: #0000BB">dio_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SEEK_CUR</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;position&nbsp;is&nbsp;now&nbsp;at&nbsp;8&nbsp;characters&nbsp;from&nbsp;the&nbsp;start&nbsp;of&nbsp;the&nbsp;file<br /><br /></span><span style="color: #0000BB">dio_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">5</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SEEK_END</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;position&nbsp;is&nbsp;now&nbsp;at&nbsp;5&nbsp;characters&nbsp;from&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file<br /><br /></span><span style="color: #0000BB">dio_seek</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">SEEK_END</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">//&nbsp;position&nbsp;is&nbsp;now&nbsp;at&nbsp;10&nbsp;characters&nbsp;past&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file.&nbsp;<br />//&nbsp;The&nbsp;10&nbsp;characters&nbsp;between&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;file&nbsp;and&nbsp;the&nbsp;current<br />//&nbsp;position&nbsp;are&nbsp;filled&nbsp;with&nbsp;zeros.<br /><br /></span><span style="color: #0000BB">dio_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>       </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.dio-read.html">dio_read</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.dio-stat.html">dio_stat</a></div> <div class="up"><a href="ref.dio.html">Direct IO Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

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