Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fgetpos(3S) — bsd — Apollo Domain/OS SR10.4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3S)

FSEEK(3S)                            BSD                             FSEEK(3S)



NAME
     fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream

SYNOPSIS
     #include <stdio.h>

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

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

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

     long int ftell(stream)
     FILE *stream;

     rewind(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, the current position, or the end of the file, respectively,
     according to whether ptrname has the value SEEK_SET, SEEK_CUR, or
     SEEK_END.

     fsetpos sets the file position indicator for the stream pointed to by
     stream according to the value of the object pointed to by pos, which must
     be a value obtained from an earlier call to fgetpos on the same stream.

     A successful call to fsetpos clears the end-of-file indicator for the
     stream and undoes any effects of ungetc on the same stream.  After a call
     to fsetpos, the next operation on an update stream 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.  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 (void)fseek(stream, 0L, SEEK_SET), 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