suve

awful: function: getchar

Declaration

string :getchar

Summary

Returns a single byte from stdin. If any bytes are waiting in buffer, takes the first byte, removing it from buffer. If the buffer is empty, awaits for a line of input on stdin. No whitespace trimming is done.

Example

# Take a single byte from stdin and return the character's ASCII codepoint.
:set &CHR :getchar
:writeln s'"' $CHR s'" = ASCII(' (:ord $CHR) s')'

wikipage modified on 2014/0601/2317