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++ Language Reference - output - class ostream http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Output - class ostream
   We  will deal first with output. Let us look at an example, using  the
   famous, Hello World program.

   #include <stream.hpp>
   main()
   {
        cout << "Hello world\n";
   }
   This  overloading  of  the left shift operator is  provided  by  class
   ostream. This deals with the output of built-in types, and is designed
   to  make  implementation of output for user defined types  simple  and
   type-safe.

   // Other output functions
   ostream& flush()
   { bp->overflow(); return *this; }
   ostream& put(char);

   // Stream state access functions
   int good() { return state == _good; }
   int eof() { return state & _eof; }
   int fail() { return state & (_fail | _bad); }
   int bad() { return state & _bad; }
   operator void*()
   { return !state? this: 0; }
   int operator !() { return state; }
   int rdstate() { return state; }

   // State set function
   void clear(state_value v = 0)
   { state = v; }

   // Access to associated buffer
   char *bufptr() { return bp->bufptr(); }

   // Constructors
   ostream(streambuf*);

   ostream(int fd);
   ostream(int buflen, char *buf);

   // Destructor
   ~ostream() { flush(); if(alloc) delete bp; }
   };


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