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

Usage

   #include <iostream.hpp>
   ostream &ostream::write(const void *data, size_t size);

Description

   This should be regarded as an unformatted or raw output operation. The
   prefix function is called. If this returns a non-zero value, an attempt
   is made to stuff size characters starting at address data into the
   associated streambuf. The error flags are set if the operation fails. The
   suffix function is not called.

   The number of characters sucessfully transferred can be read by a call to
   ostream::pcount(). The pcount() function is used by inserters etc., so it
   should be used immediately after the write().

Example 

   Thing x;

   ofstream osf("output.dat");     // a file based ostream

   osf.write(&x, sizeof(Thing));   // copy x as is
   if (osf.pcount() != sizeof(Thing))
       ...;                        // something went wrong

Return Value

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





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