O'Reilly logo

C++ In a Nutshell by Ray Lischner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

strstreambuf class — I/O buffer for character array streams

Synopsis

class strstreambuf : public basic_streambuf<char> {
public:
  explicit strstreambuf(streamsize alsize_arg = 0);
  strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
  strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
  strstreambuf(const char* gnext_arg, streamsize n);
  strstreambuf(signed char* gnext_arg, streamsize n, 
               signed char* pbeg_arg = 0);
  strstreambuf(const signed char* gnext_arg, streamsize n);
  strstreambuf(unsigned char* gnext_arg, streamsize n,
               unsigned char* pbeg_arg = 0);
  strstreambuf(const unsigned char* gnext_arg, streamsize n);
  virtual ~strstreambuf(  );
   
  void freeze(bool freezefl = true);
  char* str(  );
  int pcount(  );
   
protected:
  virtual int_type overflow (int_type c = EOF);
  virtual int_type pbackfail(int_type c = EOF);
  virtual int_type underflow(  );
  virtual pos_type seekoff(off_type off, ios_base::seekdir way,
                           ios_base::openmode which = ios_base::in | 
                           ios_base::out);
  virtual pos_type seekpos(pos_type sp, 
                           ios_base::openmode which = ios_base::in | 
                           ios_base::out);
};

The strstreambuf class implements a stream buffer for character array streams. An internal buffer maintains a single character array with separate positions for reading and writing. That is, the buffer has begin, next, and end pointers for reading and separate begin, next, and end pointers for writing. The begin pointer points to the start of a buffer, and the end pointer points to one past the end of the buffer. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required