Streambuf and streams

From: Henry (not_avalible_at_hotmail.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 15:29:03 GMT

Hello!
Im trying to get a memstream object to work but it seems that I miss
something!
My expectation is to have one stream for input and another for output!
I also expect the streambuf to handle the allocation and deallocation of
memory automaticly!
Is it possible?
I have some C++ books but they all has poor coveridge on this topic!

Any examples on this topic!
.or help!
Here is my snippet!
It compiles and executes but the output is 'Count 0'
-----------------------------------------------------------
class CMemStream : public basic_streambuf<UCHAR,char_traits<UCHAR> >
{
public:
typedef basic_istream<UCHAR, char_traits<UCHAR> > In;
typedef basic_ostream<UCHAR, char_traits<UCHAR> > Out;
};

void Test()
{
 CMemStream b;
 CMemStream::Out o(&b);
 CMemStream::In i(&b);
 o << 0x41;
 cout << "Count " << i.gcount() << endl;
}

-----------------------------------------------------------
..Henry



Relevant Pages

  • Re: The besterest thing about the Grateful Dead
    ... Tuesday or a Sunday, Shows in a stream of shows, sometimes a bunch in ... Was never quite sure if it was a lack of expectation ... Lance ...
    (rec.music.gdead)
  • Re: Streambuf and streams
    ... >My expectation is to have one stream for input and another for output! ... CMemStream doesn't actually do anything - you need to override virtual ... (it is being reviewed for inclusion in the boost libraries at the ...
    (comp.lang.cpp)
  • Re: Viruses on i5/OS
    ... executes AIX binaries ... method for which the instruction stream can be copied [to another ... on i5/OS the program is an /object/, there is no manner in which to ...
    (comp.sys.ibm.as400.misc)
  • Overriding the "lowest level" stream procedures
    ... I'd like to ensure that any piece of code in a program that executes: ... (Where T is String or a type derived from String and S is an object of ... Has to go through my Stream procedures. ...
    (comp.lang.ada)