fgetpos(3)


NAME

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

SYNOPSIS

   #include <stdio.h>

   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, const 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 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.  Or: the resulting file offset would be negative.

   The  functions 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).

ATTRIBUTES

   For   an   explanation   of   the  terms  used  in  this  section,  see
   attributes(7).

   
   Interface                    Attribute      Value   
   
   fseek(), ftell(), rewind(),  Thread safety  MT-Safe 
   fgetpos(), fsetpos()                                
   

CONFORMING TO

   POSIX.1-2001, POSIX.1-2008, C89, C99.

SEE ALSO

   lseek(2), fseeko(3)

COLOPHON

   This page is part of release 4.09 of the Linux  man-pages  project.   A
   description  of  the project, information about reporting bugs, and the
   latest    version    of    this    page,    can     be     found     at
   https://www.kernel.org/doc/man-pages/.


More Linux Commands

manpages/jvmjar.1.html
jvmjar(1) - (unknown subject) (Commands - Linux man page)...
-l|u: link/unlink jars -jar: name of the jar present in /usr/share/java-ext to install as a jvm extension For example: jaf for /usr/share/java-ext/jaf.jar Only

manpages/SDL_ShowCursor.3.html
SDL_ShowCursor(3) - Toggle whether or not the cursor is show
Toggle whether or not the cursor is shown on the screen. Passing SDL_ENABLE displays the cursor and passing SDL_DISABLE hides it. The current state of the mouse

manpages/tcgetpgrp.3.html
tcgetpgrp(3) - get and set terminal foreground process group
The function tcgetpgrp() returns the process group ID of the foreground process group on the terminal associated to fd, which must be the controlling terminal o

manpages/Xorg.1.html
Xorg(1) - X11R7 X server (Commands - Linux manual page).....
Xorg is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware. It now runs on a wider ran

manpages/resize_term.3ncurses.html
resize_term(3ncurses) - change the curses terminal size.....
This is an extension to the curses library. It provides callers with a hook into the ncurses data to resize windows, primarily for use by programs running in an

manpages/clntraw_create.3.html
clntraw_create(3) - library routines for remote procedure ca
These routines allow C programs to make procedure calls on other machines across the network. First, the client calls a procedure to send a data packet to the s

manpages/gnative2ascii-4.6.1.html
gnative2ascii-4.6(1) - - An encoding converter (Man Page)...
To be written ... OPTIONS -encoding NAME Set the encoding to use. -reversed Convert from encoding to native. Standard options: -help Print help text, then exit.

manpages/llength.n.html
llength(n) - Count the number of elements in a list.........
Treats list as a list and returns a decimal string giving the number of elements in it. EXAMPLES The result is the number of elements: % llength {a b c d e} 5 %

manpages/_tracechar.3ncurses.html
_tracechar(3ncurses) - curses debugging routines (Man Page)
The trace routines are used for debugging the ncurses libraries, as well as applications which use the ncurses libraries. These functions are normally available

manpages/menu_visible.3menu.html
menu_visible(3menu) - check visibility of a menu item.......
A menu item is visible when it is in the portion of a posted menu that is mapped onto the screen (if the menu is scrollable, in particular, this portion will be

manpages/cpupower-idle-info.1.html
cpupower-idle-info(1) Utility to retrieve cpu idle kernel in
A tool which prints out per cpu idle information helpful to developers and interested users. OPTIONS -f --silent Only print a summary of all available C-states

manpages/rtnetlink.7.html
rtnetlink(7) - Linux IPv4 routing socket - Linux man page...
Rtnetlink allows the kernels routing tables to be read and altered. It is used within the kernel to communicate between various subsystems, though this usage is





We can't live, work or learn in freedom unless the software we use is free.