readChar

HC Communication Receivers readChar
readWord rC

readChar
rC


reads a single character from the read stream and outputs that character as a word. If the read stream is a file, and the end of file is reached, READCHAR outputs the empty list (not the empty word). If the read stream is a terminal, echoing is turned off when READCHAR is invoked, and remains off until readList or readWord is invoked or a Logo prompt is printed. Backslash, vertical bar, and tilde characters have no special meaning in this context.

Extensions: If the read stream is the keyboard and special keys like the arrow keys or numpad keys are typed, then rc returns char 255 and a consecutive call to readCharExt returns the extended char value.

Example:

to keyptest
	forever
	[	if key?
		[	c=readchar
			ifelse c == char 255
			[	c=readCharExt
				(pr "ext c)
			]
			[	(pr rawASCII c c)
			]
		]
	]
end

See also:

Examples:

References:

readWord rC