Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fseek(3S) — sysv — mips UMIPS RISC/os 4.52

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lseek(2)

fopen(3S)

popen(3S)

stdio(3S)

ungetc(3S)



FSEEK(3S-SysV)      RISC/os Reference Manual       FSEEK(3S-SysV)



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

SYNOPSIS
     #include <bsd/sys/types.h>
     #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 sets the position of the next input or output opera-
     tion on the stream.  The new position is at the signed dis-
     tance offset bytes from the beginning, from the current
     position, or from the end of the file, according as 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 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 non-zero 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 posi-
     tions relative to that offset, portability to non-UNIX sys-
     tems requires that an offset be used by fseek directly.
     Arithmetic may not meaningfully be performed on such an



                         Printed 1/15/91                   Page 1





FSEEK(3S-SysV)      RISC/os Reference Manual       FSEEK(3S-SysV)



     offset, which is not necessarily measured in bytes.






















































 Page 2                  Printed 1/15/91



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