Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 12368

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>php_stream_seek</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="Streams Common API Reference"
HREF="streams.common-api.html"><LINK
REL="PREVIOUS"
TITLE="php_stream_flush"
HREF="streams.php-stream-flush.html"><LINK
REL="NEXT"
TITLE="php_stream_tell"
HREF="streams.php-stream-tell.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="streams.php-stream-flush.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="streams.php-stream-tell.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="streams.php-stream-seek"
></A
>php_stream_seek</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN252752"
></A
>php_stream_seek&nbsp;--&nbsp;Reposition a stream</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN252755"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>php_stream_seek</B
> ( php_stream * stream, off_t offset, int whence )<BR
></BR
><P
>&#13;     <B
CLASS="function"
>php_stream_seek()</B
> repositions the internal
     position of <CODE
CLASS="parameter"
>stream</CODE
>.
     The new position is determined by adding the <CODE
CLASS="parameter"
>offset</CODE
>
     to the position indicated by <CODE
CLASS="parameter"
>whence</CODE
>.
     If <CODE
CLASS="parameter"
>whence</CODE
> is set to <TT
CLASS="constant"
><B
>SEEK_SET</B
></TT
>,
     <TT
CLASS="constant"
><B
>SEEK_CUR</B
></TT
> or <TT
CLASS="constant"
><B
>SEEK_END</B
></TT
> the offset
     is relative to the start of the stream, the current position or the end of the stream, respectively.
    </P
><P
>&#13;     <B
CLASS="function"
>php_stream_seek()</B
> returns 0 on success, but -1 if there was an error.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
     Not all streams support seeking, although the streams API will emulate a seek if
     <CODE
CLASS="parameter"
>whence</CODE
> is set to <TT
CLASS="constant"
><B
>SEEK_CUR</B
></TT
>
     and <CODE
CLASS="parameter"
>offset</CODE
> is positive, by calling <B
CLASS="function"
>php_stream_read()</B
>
     to read (and discard) <CODE
CLASS="parameter"
>offset</CODE
> bytes.
      </P
><P
>&#13;      The emulation is only applied when the underlying stream implementation does not
      support seeking.  If the stream is (for example) a file based stream that is wrapping
      a non-seekable pipe, the streams api will not apply emulation because the file based
      stream implements a seek operation; the seek will fail and an error result will be
      returned to the caller.
      </P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="streams.php-stream-flush.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="streams.php-stream-tell.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>php_stream_flush</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="streams.common-api.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>php_stream_tell</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>