[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[comp.lang.c++] Re: how to replace std::streambuf::setb(...) ?
From: |
Felix Natter |
Subject: |
[comp.lang.c++] Re: how to replace std::streambuf::setb(...) ? |
Date: |
22 Jun 2001 20:04:48 +0200 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
hi,
how can I replace std::streambuf::setb(...) ?
here is the code that uses it:
void TCPStream::Allocate(int size)
{
if(size < 2)
{
bufsize = 1;
return;
}
gbuf = new char[size];
pbuf = new char[size];
if(!pbuf || !gbuf)
{
Error(SOCKET_RESOURCE_FAILURE);
return;
}
bufsize = size;
clear();
setb(gbuf, gbuf + size, 0);
setg(gbuf, gbuf + size, gbuf + size);
setp(pbuf, pbuf + size);
}
here is the reply from comp.lang.c++:
--- Begin Message ---
Subject: |
Re: how to replace std::streambuf::setb(...) ? |
Date: |
Fri, 22 Jun 2001 21:19:25 +0200 |
Hi,
Felix Natter wrote:
> how can I replace std::streambuf::setb(...) ?
What is is it supposed to do? I would guess that it was used to
set up a put back area or something like this. I don't think
that you really need this because the calls to 'setg()' and
'setp()' are sufficient to deal with buffer management.
BTW, you can remoe the test for allocation failure, too: An
exception will be thrown ('std::bad_alloc') if allocation fails.
--
<mailto:address@hidden> <http://www.dietmar-kuehl.de/>
Phaidros eaSE - Easy Software Engineering: <http://www.phaidros.com/>
--- End Message ---
--
Felix Natter
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [comp.lang.c++] Re: how to replace std::streambuf::setb(...) ?,
Felix Natter <=