Movatterモバイル変換


[0]ホーム

URL:


[LISPWORKS][Common Lisp HyperSpec (TM)][Previous][Up][Next]


FunctionREAD-CHAR

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.


The followingX3J13 cleanup issues,not part of the specification, apply to this section:


[Starting Points][Contents][Index][Symbols][Glossary][Issues]
Copyright 1996-2005, LispWorks Ltd. All rights reserved.


[8]ページ先頭

©2009-2025 Movatter.jp