Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
fseek(3)
Edit
PageHistory
Diff
Info
LikePages
FSEEK !!!FSEEK NAME SYNOPSIS DESCRIPTION RETURN VALUE ERRORS CONFORMING TO SEE ALSO ---- !!NAME fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream !!SYNOPSIS __#include __ __int fseek( FILE *__''stream''__, long__ ''offset''__, int__ ''whence''__); long ftell( FILE *__''stream''__); void rewind( FILE *__''stream''__); int fgetpos( FILE *__''stream''__, fpos_t *__''pos''__); int fsetpos( FILE *__''stream''__, fpos_t *__''pos''__);__ !!DESCRIPTION The __fseek__ function sets the file position indicator for the stream pointed to by ''stream''. The new position, measured in bytes, is obtained by adding ''offset'' bytes to the position specified by ''whence''. If ''whence'' is set to __SEEK_SET__, __SEEK_CUR__, or __SEEK_END__, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the __fseek__ function clears the end-of-file indicator for the stream and undoes any effects of the ungetc(3) function on the same stream. The __ftell__ function obtains the current value of the file position indicator for the stream pointed to by ''stream''. The __rewind__ function sets the file position indicator for the stream pointed to by ''stream'' to the beginning of the file. It is equivalent to: (void)fseek(stream, 0L, SEEK_SET) except that the error indicator for the stream is also cleared (see clearerr(3)). The __fgetpos__ and __fsetpos__ functions are alternate interfaces equivalent to __ftell__ and __fseek__ (with whence set to __SEEK_SET__), setting and storing the current value of the file offset into or from the object referenced by ''pos''. On some non-UNIX systems an __fpos_t__ object may be a complex object and these routines may be the only way to portably reposition a text stream. !!RETURN VALUE The __rewind__ function returns no value. Upon successful completion, __fgetpos__, __fseek__, __fsetpos__ return 0, and __ftell__ returns the current offset. Otherwise, -1 is returned and the global variable errno is set to indicate the error. !!ERRORS __EBADF__ The ''stream'' specified is not a seekable stream. __EINVAL__ The ''whence'' argument to __fseek__ was not __SEEK_SET__, __SEEK_END__, or __SEEK_CUR__. The function __fgetpos__, __fseek__, __fsetpos__, and __ftell__ may also fail and set ''errno'' for any of the errors specified for the routines fflush(3), fstat(2), lseek(2), and malloc(3). !!CONFORMING TO The __fgetpos__, __fsetpos__, __fseek__, __ftell__, and __rewind__ functions conform to ANSI X3.159-1989 (``ANSI C''). !!SEE ALSO lseek(2) ----
13 pages link to
fseek(3)
:
lseek(2)
Man3f
fgetc(3)
fputc(3)
fputs(3)
getc(3)
getchar(3)
gets(3)
putc(3)
putchar(3)
puts(3)
ungetc(3)
fgets(3)
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.