Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fgetpos(3S) — sys5 — Apollo Domain/OS SR10.3.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3S)

popen(3S)

stdio(3S)

ungetc(3S)

FSEEK(3S)                            SysV                            FSEEK(3S)



NAME
     fgetpos, fseek, fsetpos, ftell, rewind - reposition a file pointer in a
     stream

SYNOPSIS
     #include <stdio.h>

     int fgetpos(stream, pos)
     FILE *stream;
     fpos_t *pos;

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

     int fsetpos(stream, pos)
     FILE *stream;
     const fpos_t *pos;

     long int ftell(stream)
     FILE *stream;

     void rewind (stream)
     FILE *stream;

DESCRIPTION
     fgetpos stores the current value of the file position indicator for the
     stream pointed to by stream in the object pointed to by pos.  The value
     stored contains unspecified information usable by fsetpos for
     repositioning the stream to its position at the time of the call to
     fgetpos.

     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, from the current position, or from the end of the file,
     according as ptrname has the value SEEK_SET, SEEK_CUR, or SEEK_END.

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

     fseek and rewind undo any effects of ungetc(3S).

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

     ftell returns the offset of the current byte relative to the beginning of
     the file associated with the named stream.

SEE ALSO
     lseek(2), fopen(3S), popen(3S), stdio(3S), ungetc(3S).

DIAGNOSTICS
     fseek returns nonzero for improper seeks, otherwise 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).

WARNING
     Although on the UNIX system an offset returned by ftell is measured in
     bytes, and it is permissible to seek to positions relative to that
     offset, portability to other systems requires that an offset be used by
     fseek directly. Arithmetic may not meaningfully be performed on such an
     offset, which is not necessarily measured in bytes.

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