Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>filebuf::seekoff</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
filebuf::seekoff

Usage

   #include <fstream.hpp>
   virtual filebuf::seekoff(streamoff, relative_to, int mode =
   ios::in|ios::out);

Description

   Similar to seekpos except that the position specification is relative to
   either the beginning, the end, or the current get/put position. The only

   restriction on the streamoff type is that it must be large enought to
   represent any offset in a file. It is implemented here as a long.

   The enumeration relative_to is called seek_dir in some other
   implementations. This is confusing; the seek direction is controlled by
   the sign of the streamoff argument, which may be negative. A #define of
   seek_dir to relative_to is included to help portability.

   Moves the file currency (file pointer), and adjusts the contents of the
   get and put areas so that any subsequent put or get will effectively be
   to the specified position in the file. Remember, in a filebuf the get and
   put pointers are tied, so are effectively the same. For this reason, the
   mode argument is ignored.

   The seekoff function will merely return an error value if the file does
   not report seeking.

Example 

   filebuf fb;

   fb.open(...);
   ...;
   streampos pos = fb.seekoff(0,cur);
   fb.seekpos(0);      // do something at start of file
   fb.seekoff(0,end);  // do something at end
   fb.seekpos(pos);    // back to where we were

Return Value

   A value of type streampos that indicates the current file pointer
   position.





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson