![[LISPWORKS]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fLWSmall.gif&f=jpg&w=240)
![[Common Lisp HyperSpec (TM)]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fCLHS_Sm.gif&f=jpg&w=240)
Syntax:
read-char&optional input-stream eof-error-p eof-value recursive-p =>char
Arguments and Values:
input-stream---aninputstream designator. The default isstandard input.
eof-error-p---ageneralized boolean. The default istrue.
eof-value---anobject. The default isnil.
recursive-p---ageneralized boolean. The default isfalse.
char---acharacter or theeof-value.
Description:
read-char returns the nextcharacter frominput-stream.
Wheninput-stream is anecho stream, the character is echoed oninput-stream the first time the character is seen. Characters that are not echoed byread-char are those that were put there byunread-char and hence are assumed to have been echoed already by a previous call toread-char.
Ifrecursive-p istrue, this call is expected to be embedded in a higher-level call toread or a similarfunction used by theLisp reader.
If anend of file[2] occurs andeof-error-p isfalse,eof-value is returned.
Examples:
(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=> NIL
Affected By:
*standard-input*,*terminal-io*.
Exceptional Situations:
If anend of file[2] occurs before a character can be read, andeof-error-p istrue, an error oftypeend-of-file is signaled.
See Also:
read-byte,read-sequence,write-char,read
Notes:
The corresponding output function iswrite-char.