strstreambuf();
strstreambuf( int nBytes );
strstreambuf( char* pch, int n, char* pstart = 0 );
strstreambuf( unsigned char* puch, int n, unsigned char* pustart = 0 );
strstreambuf( signed char* psch, int n, signed char* psstart = 0 );
strstreambuf( void* (*falloc)(long), void (*ffree)(void*) );
nBytes
The initial length of a dynamic stream buffer.
pch, puch, psch
A pointer to a character buffer that will be attached to the object. The get pointer is initialized to this value.
n
An integer parameter with the following meanings:
Value | Meaning |
positive | n bytes, starting at pch, is used as a fixed-length stream buffer. |
0 | The pch parameter points to the start of a null-terminated string that constitutes the stream buffer (terminator excluded). |
negative | The pch parameter points to a stream buffer that continues indefinitely. |
pstart, pustart, psstart
The initial value of the put pointer.
falloc
A memory-allocation function with the prototype void* falloc( long ). The default is new.
ffree
A function that frees allocated memory with the prototype void ffree( void* ). The default is delete.
The four streambuf constructors are described as follows:
Constructor | Description |
strstreambuf() | Constructs an empty strstreambuf object with dynamic buffering. The buffer is allocated internally by the class and grows as needed, unless it is frozen. |
strstreambuf( int ) | Constructs an empty strstreambuf object with a dynamic buffer n bytes long to start with. The buffer is allocated internally by the class and grows as needed, unless it is frozen. |
strstreambuf( char*, int, char* ) | Constructs a strstreambuf object from already-allocated memory as specified by the arguments. There are constructor variations for both unsigned and signed character arrays. |
strstreambuf( void*(*), void(*) ) | Constructs an empty strstreambuf object with dynamic buffering. The falloc function is called for allocation. The long parameter specifies the buffer length and the function returns the buffer address. If the falloc pointer is NULL, then operator new is used. The ffree function frees memory allocated by falloc. If the ffree pointer is NULL, the operator delete is used. |