🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: de.comp.lang.c++
1 messages
1 total messages Started by Dieter Lücking Thu, 04 Apr 1996 19:36
Help:ostrstream/strstreambuf
#2006
Author: Dieter Lücking
Date: Thu, 04 Apr 1996 19:36
40 lines
1423 bytes
I attempt to implement a stream for message boxes.
First the example:

   class MessageBuffer : public strstreambuf
   {
      public:
      MessageBuffer()
      : strstreambuf()
      {}
	  
	  // ... more constructors
      
      virtual int sync()                   // *** First question *** //
	  {
	     // Target specific implementation.
		 // A simple example:
	     cout << this; return __NOT_EOF;
	  }
   };
   
   class Message : public ostrstream
   {
      public:
      Message()
      : ostrstream()
      { init(new MessageBuffer); }          // *** Second question *** //
      
	  // ... more constructors
   };

First question:
The function sync() should only executed if ostream::flush() is called. However i am not sure. 
Are there any side effects ?

Second question:
Deletes ~ios() any the streambuffer object or is it a job for ~Message() ?

Thanks
Danke schoen
   Dieter Luecking
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads