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>ostream::seekp</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ostream::seekp

Usage

   #include <iostream.hpp>
   ostream &ostream::seekp(streampos);
   ostream &ostream::seekp(streamoff, relative_to);

   // iostream.hpp has - typedef long streampos, streamoff

Description

   Positions the put pointer of the associated streambuf. In the case of a
   file based ostream, the action is similar to that of the stdio fseek()
   function. Positioning is discussed further in the section that describes
   classes streambuf and filebuf.


   The absolute form (seekp(pos)) is to be interpreted as seekp(pos,
   ios::beg), that is relative to the start of the streambuf.

   The value used as an argument to seekp should have been one previously
   obtained from the complementary member function tellp(). In general, it
   should not be calculated, except that the particular value streampos(0)
   is safe.

   In the case of relative seeks (e.g. seekp(0, end)) the streamoff value
   zero is safe, but other values should be treated with caution. Remember
   that under DOS it is normal to convert newline characters to CR/LF pairs
   before they are sent to an actual output device, and to convert CR/LF
   pairs to newline characters on input.

Example 

   ofstream ofs("output.dat");

   ofs.seekp(0);       // position at start of file
   ofs.put('\0');      // modify status

   ofs.seekp(0, end);  // back to appending

Return Value

   Returns a reference to the ostream object for which it was called.





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