4.3BSD-UWisc/man/cat3/fseek.3s




FSEEK(3S)           UNIX Programmer's Manual            FSEEK(3S)



NAME
     fseek, ftell, rewind - reposition a stream

SYNOPSIS
     #include <stdio.h>

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

     long ftell(stream)
     FILE *stream;

     rewind(stream)

DESCRIPTION
     _F_s_e_e_k sets the position of the next input or output opera-
     tion on the _s_t_r_e_a_m.  The new position is at the signed dis-
     tance _o_f_f_s_e_t bytes from the beginning, the current position,
     or the end of the file, according as _p_t_r_n_a_m_e has the value
     0, 1, or 2.

     _F_s_e_e_k undoes any effects of _u_n_g_e_t_c(3S).

     _F_t_e_l_l returns the current value of the offset relative to
     the beginning of the file associated with the named _s_t_r_e_a_m.
     It is measured in bytes on UNIX; on some other systems it is
     a magic cookie, and the only foolproof way to obtain an
     _o_f_f_s_e_t for _f_s_e_e_k.

     _R_e_w_i_n_d(_s_t_r_e_a_m) is equivalent to _f_s_e_e_k(_s_t_r_e_a_m, 0L, 0).

SEE ALSO
     lseek(2), fopen(3S)

DIAGNOSTICS
     _F_s_e_e_k returns -1 for improper seeks, otherwise zero.


















Printed 12/27/86        February 24, 1986                       1