User Tools


Function READ-CHAR

Syntax

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

Arguments and Values

Description

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.

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

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

Notes

The corresponding output function is write-char.

\issue{ARGUMENTS-UNDERSPECIFIED:SPECIFY} \issue{PEEK-CHAR-READ-CHAR-ECHO:FIRST-READ-CHAR} \issue{READ-AND-WRITE-BYTES:NEW-FUNCTIONS}