FSEEK(3S) DOMAIN/IX Reference Manual (SYS5) FSEEK(3S)
NAME
fseek, rewind, ftell - reposition a file pointer in a stream
USAGE
#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
Fseek determines where the next input or output operation on
the stream will take place. The new position is at the
signed distance offset bytes from the beginning, from the
current position, or from the end of the file, depending on
whether ptrname has the value 0, 1, or 2.
Rewind(stream) is equivalent to fseek(stream,0L,0), except
that no value is returned.
Fseek and rewind undo the effects of an ungetc(3S) call.
After fseek or rewind, the next operation on a file opened
for update can be either input or output.
Ftell returns the offset of the current byte from the begin-
ning of the file associated with the named stream.
NOTES
On the DOMAIN/IX system, an offset returned by ftell is
measured in bytes, and a program can seek to a position
relative to that offset. However, portability to other than
DOMAIN/IX systems requires that an offset be used by fseek
directly. Such an offset is not necessarily in bytes, and
when performed on such an offset, arithmetic may not be
meaningful.
DIAGNOSTICS
Fseek returns non-zero for improper `seeks.' Otherwise, it
returns zero. An improper seek can be, for example, an
fseek done on a file that has not been opened via fopen; in
particular, fseek may not be used on a terminal, or on a
file opened via popen(3S).
Printed 5/10/85 FSEEK-1
FSEEK(3S) DOMAIN/IX Reference Manual (SYS5) FSEEK(3S)
RELATED INFORMATION
lseek(2), fopen(3S), popen(3S), ungetc(3S).
FSEEK-2 Printed 5/10/85