mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 23:38:56 +00:00

Patch provided by Gavin Staniforth. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@340477 c90b9560-bf6c-de11-be94-00142212c4b1
119 lines
3.3 KiB
XML
119 lines
3.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="splfileobject.fseek" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SplFileObject::fseek</refname>
|
|
<refpurpose>Seek to a position</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>int</type><methodname>SplFileObject::fseek</methodname>
|
|
<methodparam><type>int</type><parameter>offset</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>whence</parameter><initializer>SEEK_SET</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Seek to a position in the file measured in bytes
|
|
from the beginning of the file, obtained by adding
|
|
<parameter>offset</parameter> to the position specified by
|
|
<parameter>whence</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>offset</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The offset. A negative value can be used to move backwards through the file which
|
|
is useful when SEEK_END is used as the <parameter>whence</parameter> value.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>whence</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>whence</parameter> values are:
|
|
<simplelist>
|
|
<member><constant>SEEK_SET</constant> - Set position equal to <parameter>offset</parameter> bytes.</member>
|
|
<member><constant>SEEK_CUR</constant> - Set position to current location plus <parameter>offset</parameter>.</member>
|
|
<member><constant>SEEK_END</constant> - Set position to end-of-file plus <parameter>offset</parameter>.</member>
|
|
</simplelist>
|
|
</para>
|
|
<para>
|
|
If <parameter>whence</parameter> is not specified, it is assumed to be <constant>SEEK_SET</constant>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns 0 if the seek was successful, -1 otherwise. Note that seeking
|
|
past EOF is not considered an error.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><methodname>SplFileObject::fseek</methodname> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$file = new SplFileObject("somefile.txt");
|
|
|
|
// Read first line
|
|
$data = $file->fgets();
|
|
|
|
// Move back to the beginning of the file
|
|
// Same as $file->rewind();
|
|
$file->fseek(0);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>fseek</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|