XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

get-output-stream-string


Type:   -   function (subr)
Source:   -   xlfio.c

Syntax

(get-output-stream-string stream)
stream - an output stream expression
returns - the output so far as a string

Description

The 'get-output-stream-string' function empties the specified 'stream' and returns this data as a single string. The output stream is emptied by this operation.

Examples

(setq out (make-string-output-stream))  ; returns #<Unnamed-Stream: #...>

(format out "fee fi fo fum ")           ; \
(format out "I smell the blood of ")    ;  fill up output stream
(format out "Elmer Fudd")               ; /
(get-output-stream-string out)          ; returns "fee fi fo fum I smell the blood of Elmer Fudd"

(format out "~%now what")               ; add more to output stream
(get-output-stream-string out)          ; returns "\nnow what"
(get-output-stream-string out)          ; returns ""

(format out "hello")                    ; add more to output stream
(read out)                              ; returns HELLO

See the get-output-stream-string function in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next