Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fseek(3s) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3s)

fseek(3s)

NAME

fseek, ftell, rewind − reposition a stream

SYNTAX

#include <stdio.h>

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

void rewind(stream)
FILE *stream;

long ftell(stream)
FILE *stream;

DESCRIPTION

The fseek subroutine 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, according as ptrname has the value 0, 1, or 2. 

The fseek and rewind subroutines undo any effects of ungetc(3s). 

The ftell subroutine 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 UNIX.  On some other systems, it is the only foolproof way to obtain an offset for fseek. 

The rewind(stream) subroutine is equivalent to fseek(stream, 0L, 0). 

DIAGNOSTICS

The fseek subroutine returns −1 for improper seeks and a zero otherwise. 

SEE ALSO

lseek(2), fopen(3s)

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