Function get-output-stream-string

Syntax:

get-output-stream-string string-output-stream string

Arguments and Values:

string-output-stream—a stream.

string—a string.

Description:

21.2.0 10Returns a string containing, in order, all the characters that have been output to string-output-stream. This operation clears any characters on string-output-stream, so the string contains only those characters which have been output since the last call to get-output-stream-string or since the creation of the string-output-stream, whichever occurred most recently.

Examples:

 (setq a-stream (make-string-output-stream)
        a-string "abcdefghijklm") → "abcdefghijklm"
 (write-string a-string a-stream) → "abcdefghijklm"
 (get-output-stream-string a-stream) → "abcdefghijklm"
 (get-output-stream-string a-stream) → ""

Side Effects:

The string-output-stream is cleared.

Affected By:

None.

Exceptional Situations:

The result of calling \funref{get-output-stream-string} on the \param{string-stream} returned by \funref{make-string-output-stream} is unspecified after \funref{close}. Rewritten for Sandra:The consequences are undefined if stream-output-string is closed.

The consequences are undefined if string-output-stream is a stream that was not produced by make-string-output-stream. The consequences are undefined if string-output-stream was created implicitly by with-output-to-string or format.

Redundant -- Said already in WITH-OUTPUT-TO-STRING and FORMAT. -kmp 14-Feb-92 In the cases where a \term{string} argument with a \term{fill pointer} is supplied as an \term{argument} to \macref{with-output-to-string} or \funref{format}, the consequences are undefined if destructive modifications are performed directly on the \term{string} during the \term{dynamic extent} of the call.

See Also:

make-string-output-stream

Notes:

None.