User Tools


Function GET-OUTPUT-STREAM-STRING

Syntax

  • get-output-stream-string string-output-streamstring

Arguments and Values

Description

Returns 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

(defparameter *a-stream* (make-string-output-stream))

*A-STREAM*

(defparameter *a-string* "abcdefghijklm")

*A-STRING*

*a-stream*

"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 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.

See Also

Notes

None.

\issue{CLOSE-CONSTRUCTED-STREAM:ARGUMENT-STREAM-ONLY} \issue{STRING-OUTPUT-STREAM-BASHING:UNDEFINED}