51 class ptrinbuf :
public std::streambuf
53 ptrinbuf(
const ptrinbuf&);
54 ptrinbuf& operator=(
const ptrinbuf&);
61 ptrinbuf(
char * _ptr, std::size_t _len) : ptr(_ptr), len(_len) {
63 len = std::strlen(ptr);
76 virtual int_type underflow() {
79 return traits_type::to_int_type(*gptr());
84 virtual pos_type seekoff(off_type off, ios_base::seekdir way,
90 switch (
static_cast<int>(way)) {
92 setg(ptr, gptr()+off, ptr+len);
95 setg(ptr, ptr+off, ptr+len);
98 setg(ptr, egptr()+off, ptr+len);
101 return pos_type(gptr() - ptr);
110 : std::istream(0),
buf(ptr, len) {