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

30  String Stream Functions


  1. make-string-input-stream - create an unnamed stream from a string expression
  2. make-string-output-stream - create and return an unnamed output stream
  3. get-output-stream-string - empty a stream and return the data as a string
  4. get-output-stream-list - empty a stream and return the data as a list

These functions operate on unnamed streams. An unnamed output stream collects characters sent to it when it is used as the destination of any output function. The functions 'get-output-stream-string' and 'get-output-stream-list' can be used to read [and empty] an unnamed output stream and return it's contents as a single string or as a list of characters. An unnamed input stream is setup with the 'make-string-input-stream' function and returns each character of the string when it is used as the source of any input function.


(make-string-input-stream string [start [end]])
string - the string
start - the starting offset
end - the ending offset + 1
returns - an unnamed stream that reads from the string

(make-string-output-stream)
returns - an unnamed output stream

(get-output-stream-string stream)
stream - the output stream
returns - the output so far as a string
Note: the output stream is emptied by this function

(get-output-stream-list stream)
stream - the output stream
returns - the output so far as a list
Note: the output stream is emptied by this function

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