view docs/ccguide/fseek.refentry @ 2437:d26e96c40194

rfm changes
author aaronwolfe
date Wed, 24 Feb 2010 00:37:08 +0000
parents fe8e46eca1ed
children
line wrap: on
line source

<refentry id="fseek">
<refnamediv>
<refname>Fseek</refname>
<refname>Rewind</refname>
<refname>Ftell</refname>
<refpurpose>position in a file or report current position</refpurpose>
</refnamediv>

<refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;stdio.h&gt;
</funcsynopsisinfo>

<funcprototype>
  <funcdef><function>fseek</function></funcdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
  <paramdef>long <parameter>offset</parameter></paramdef>
  <paramdef>int <parameter>place</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef><function>rewind</function></funcdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>

<funcprototype>
  <funcdef>long <function>ftell</function></funcdef>
  <paramdef>FILE *<parameter>fp</parameter></paramdef>
</funcprototype>
</funcsynopsis>

</refsynopsisdiv>

<refsect1><title>Description</title>
<para>
Fseek repositions the next character position of a file for
either read or write. The new position is a "offset" bytes
from the beginning of the file if "place" is 0, the current
position is 1, or the end if 2. Fseek sorts out the special
problems of buffering.
</para>
<para>
NOTE that using "lseek()" on a buffered file will produce
unpredictable results.
</para>
<para>
Rewind is equivalent to "fseek(fp,0L,0)".
</para>
<para>
Ftell returns the current position, measured in bytes, from the
beginning of the file pointed to by "fp".
</para>
</refsect1>

<refsect1><title>Diagnostics</title>
<para>
Fseek returns -1 if the call is invalid.
</para>
</refsect1>

<refsect1><title>See Also</title>
<para>
System call
<link linkend="lseek">lseek()</link>.
</para>
</refsect1>

</refentry>