strstream - Member Functions and Data by Group

Constructors & Destructor

Objects of the strstream class can be constructed and destructed.

~strstream
public:~strstream()

This is supported on AIX OS/400 z/OS

The strstream destructor frees the space allocated by the strstream constructor.

strstream
Overload 1
public:strstream(char* str, long size, int mode)

This is supported on AIX z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

This function is available for 64-bit applications. The second argument is a long value.

Overload 2
public:strstream(char* str, int size, int mode)

This is supported on AIX OS/400 z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

AIX and z/OS Considerations

This function is available for 32-bit applications. The second argument is an int value.

Overload 3
public:strstream(signed char* str, long size, int mode)

This is supported on AIX z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

This function is available for 64-bit applications. The second argument is a long value.

Overload 4
public:strstream(unsigned char* str, int size, int mode)

This is supported on AIX OS/400 z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

AIX and z/OS Considerations

This function is available for 32-bit applications. The second argument is an int value.

Overload 5
public:strstream(signed char* str, int size, int mode)

This is supported on AIX OS/400 z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

AIX and z/OS Considerations

This function is available for 32-bit applications. The second argument is an int value.

Overload 6
public:strstream(unsigned char* str, long size, int mode)

This is supported on AIX z/OS

This constructor specifies that characters should be extracted and inserted into the array of bytes that starts at the position pointed to by str with a length of size bytes. If ios::ate or ios::app is set in mode, str points to a null-terminated string and insertions begin at the null character. Otherwise, insertions begin at the position pointed to by str. You can use the istream::seekg() function to reposition the get pointer anywhere in this array.

This function is available for 64-bit applications. The second argument is a long value.

Overload 7
public:strstream()

This is supported on AIX OS/400 z/OS

This constructor takes no arguments and specifies that space is allocated dynamically for the stream buffer that is attached to the strstream object.

Stream Buffer Functions

str
public:char* str()

This is supported on AIX OS/400 z/OS

Returns a pointer to the stream buffer attached to the strstream and calls freeze() with a nonzero value to prevent the stream buffer from being deleted. If the stream buffer was constructed with an explicit array, the value returned is a pointer to that array. If the stream buffer was constructed in dynamic mode, str points to the dynamically allocated area.

Until you call str(), deleting the dynamically allocated stream buffer is the responsibility of the strstream object. After str() has been called, the calling application has responsibility for the dynamically allocated stream buffer.

Note: If your application calls str() without calling freeze() with a nonzero argument (to unfreeze the strstream), or without explicitly deleting the array of characters returned by the call to str(), the array of characters will not be deallocated by the strstream when it is destroyed. This situation is a potential source of a memory leak.