minix/man/man3/fseek.3

66 lines
1.3 KiB
Groff
Raw Normal View History

2005-05-02 15:01:42 +02:00
.\" @(#)fseek.3s 6.3 (Berkeley) 2/24/86
.\"
.TH FSEEK 3 "February 24, 1986"
.AT 3
.SH NAME
2010-08-16 19:07:40 +02:00
fseek, fseeko, ftell, ftello, rewind \- reposition a stream
2005-05-02 15:01:42 +02:00
.SH SYNOPSIS
.nf
.ft B
#include <stdio.h>
int fseek(FILE *\fIstream\fP, long \fIoffset\fP, int \fIptrname\fP)
2010-08-16 19:06:08 +02:00
int fseeko(FILE *\fIstream\fP, off_t \fIoffset\fP, int \fIptrname\fP)
2005-05-02 15:01:42 +02:00
long ftell(FILE *\fIstream\fP)
2010-08-16 19:07:40 +02:00
off_t ftello(FILE *\fIstream\fP)
2005-05-02 15:01:42 +02:00
void rewind(FILE *\fIstream\fP)
.ft R
.fi
.SH DESCRIPTION
.B Fseek
2010-08-16 19:06:08 +02:00
and
.B fseeko
set the position of the next input or output
2005-05-02 15:01:42 +02:00
operation on the
.IR stream .
The new position is at the signed distance
.I offset
bytes
from the beginning, the current position, or the end of the file,
according as
.I ptrname
has the value 0, 1, or 2.
.PP
.B Fseek
2010-08-16 19:06:08 +02:00
and
.B fseeko
undo any effects of
2005-05-02 15:01:42 +02:00
.BR ungetc (3).
.PP
.B Ftell
2010-08-16 19:07:40 +02:00
and
.B ftello
return the current value of the offset relative to the beginning
2005-05-02 15:01:42 +02:00
of the file associated with the named
.IR stream .
It is measured in bytes on UNIX;
on some other systems it is a magic cookie,
and the only foolproof way to obtain an
.I offset
for
2010-08-16 19:06:08 +02:00
.BR fseek
and
.BR fseeko .
2005-05-02 15:01:42 +02:00
.PP
.BR Rewind "(\fIstream\fR)"
is equivalent to
.BR fseek "(\fIstream\fR, 0L, 0)."
.SH "SEE ALSO"
.BR lseek (2),
.BR fopen (3).
.SH DIAGNOSTICS
.B Fseek
2010-08-16 19:06:08 +02:00
and
.B fseeko
return \-1 for improper seeks, otherwise zero.