<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.gzseek" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>gzseek</refname>
  <refpurpose>Seek on a gz-file pointer</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>int</type><methodname>gzseek</methodname>
   <methodparam><type>resource</type><parameter>stream</parameter></methodparam>
   <methodparam><type>int</type><parameter>offset</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>whence</parameter><initializer><constant>SEEK_SET</constant></initializer></methodparam>
  </methodsynopsis>
  <para>
   Sets the file position indicator for the given file pointer to the
   given offset byte into the file stream. Equivalent to calling (in C)
   <literal>gzseek(zp, offset, SEEK_SET)</literal>.
  </para>
  <para>
   If the file is opened for reading, this function is emulated but
   can be extremely slow. If the file is opened for writing, only
   forward seeks are supported; <function>gzseek</function> then compresses
   a sequence of zeroes up to the new starting position.
  </para>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>stream</parameter></term>
     <listitem>
      <para>
       The gz-file pointer. It must be valid, and must point to a file
       successfully opened by <function>gzopen</function>.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>offset</parameter></term>
     <listitem>
      <para>
       The seeked offset.
      </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>
       </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>
   Upon success, returns 0; otherwise, returns -1. Note that seeking
   past EOF is not considered an error.
  </para>
 </refsect1>
 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title><function>gzseek</function> example</title>
    <programlisting role="php">
<![CDATA[
<?php
$gz = gzopen('somefile.gz', 'r');
gzseek($gz,2);
echo gzgetc($gz);
gzclose($gz);
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>
 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>gztell</function></member>
    <member><function>gzrewind</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
-->
