共用方式為


ostrstream::ostrstream

Constructs an object of type ostrstream.

ostrstream( ); 
ostrstream( 
   char *_Ptr,  
   streamsize _Count, 
   ios_base::openmode _Mode = ios_base::out 
);

Parameters

  • _Ptr
    The buffer.

  • _Count
    The size of the buffer in bytes.

  • _Mode
    The input and output mode of the buffer. See ios_base::openmode for more information.

Remarks

Both constructors initialize the base class by calling ostream(sb), where sb is the stored object of class strstreambuf. The first constructor also initializes sb by calling strstreambuf. The second constructor initializes the base class one of two ways:

  • If _Mode & ios_base::app== 0, then _Ptr must designate the first element of an array of _Count elements, and the constructor calls strstreambuf(_Ptr, _Count, _Ptr).

  • Otherwise, _Ptr must designate the first element of an array of count elements that contains a C string whose first element is designated by _Ptr, and the constructor calls strstreambuf( _Ptr, _Count, _Ptr + strlen(_Ptr) ).

Requirements

Header: <strstream>

Namespace: std

See Also

Reference

ostrstream Class

iostream Programming

iostreams Conventions