H
Henry
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;
}
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;
}