Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ftell(3S) — AUX SR8.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3S)

FSEEK(3S)

NAME

fseek, ftell, rewind − reposition a stream

SYNOPSIS

#include <stdio.h>

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

long ftell (stream)
FILE ∗stream;

rewind(stream)
FILE ∗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, according as ptrname has the value 0, 1, or 2. 

Fseek undoes any effects of ungetc(3S).

After fseek or rewind, the next operation on an update file may be either input or output.

Ftell returns the current value of the offset relative to the beginning of the file associated with the named stream. The offset is measured in bytes on UNIX 3.0 and UNIX/RT; on some other systems, it is a magic cookie and is the only foolproof way to obtain an offset for fseek.

Rewind(stream) is equivalent to fseek(stream, 0L, 0).

SEE ALSO

lseek(2), fopen(3S). 

DIAGNOSTICS

Fseek returns non-zero for improper seeks, otherwise zero. 

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