Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fseek(3S) — bsd — Apollo

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3S)

FSEEK(3S)                            BSD                             FSEEK(3S)



NAME
     fseek, ftell, rewind - reposition a stream

SYNOPSIS
     #include <stdio.h>

     fseek(stream, offset, ptrname)
     FILE *stream;
     long offset;

     long ftell(stream)
     FILE *stream;

     rewind(stream)

DESCRIPTION
     fseek sets the position of the next input or output operation on the
     stream.  The new position is at the signed distance offset bytes from the
     beginning, the current position, or the end of the file, respectively,
     according to whether ptrname has the value 0, 1, or 2.

     fseek undoes any effects of ungetc(3S).

     ftell returns the current value of the offset relative to the beginning
     of the file associated with the named stream.  It is measured in bytes on
     the UNIX operating system; on some other systems it is a magic cookie and
     the only foolproof way to obtain an offset for fseek.

     rewind(stream) is equivalent to fseek(stream, 0L, 0), except that no
     value is returned.

SEE ALSO
     lseek(2), fopen(3S)

DIAGNOSTICS
     fseek returns -1 for improper seeks; otherwise it returns 0.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026