User Tools

Function READ-CHAR


  • read-char &optional input-stream eof-error-p eof-value recursive-pchar

Arguments and Values


read-char returns the next character from input-stream.

When input-stream is an echo stream, the character is echoed on input-stream the first time the character is seen. Characters that are not echoed by read-char are those that were put there by unread-char and hence are assumed to have been echoed already by a previous call to read-char.

If recursive-p is true, this call is expected to be embedded in a higher-level call to read or a similar function used by the Lisp reader.

If an end of file occurs and eof-error-p is false, eof-value is returned.


(with-input-from-string (is "0123") (do ((c (read-char is) (read-char is nil 'the-end))) ((not (characterp c))) (format t "~S " c)))

#\0 #\1 #\2 #\3


Affected By

Exceptional Situations

If an end of file occurs before a character can be read, and eof-error-p is true, an error of type end-of-file is signaled.

See Also


The corresponding output function is write-char.