P
Peter Jansson
Dear newsgroup,
I have implemented a class that inherits from std::streambuf (in order to
create a stream for some specialized I/O). In the constructor, I have the
following code (bufferSize is a previously defined const unsigned int):
char* p1=new char[bufferSize];
std::streambuf::setg(p1,p1,p1+bufferSize);
char* p2=new char[bufferSize];
std::streambuf::setp(p2,p2+bufferSize);
Do anybody know of any way to test if setg and/or setp was successful or
not? (They are both returning void and are not throwing any exceptions,
according to sections 27.5.2.3.1 and 27.5.2.3.2 in the standard.) Should,
perhaps, the postconditions be used for this?
Regards,
Peter Jansson
http://www.jansson.net/
I have implemented a class that inherits from std::streambuf (in order to
create a stream for some specialized I/O). In the constructor, I have the
following code (bufferSize is a previously defined const unsigned int):
char* p1=new char[bufferSize];
std::streambuf::setg(p1,p1,p1+bufferSize);
char* p2=new char[bufferSize];
std::streambuf::setp(p2,p2+bufferSize);
Do anybody know of any way to test if setg and/or setp was successful or
not? (They are both returning void and are not throwing any exceptions,
according to sections 27.5.2.3.1 and 27.5.2.3.2 in the standard.) Should,
perhaps, the postconditions be used for this?
Regards,
Peter Jansson
http://www.jansson.net/