ASCII codes for the non-printable characters (i.e. control characters) are also acceptable.
Note tyi/2 reads from the stream in raw mode. If it is combined with the buffered predicates, it might happen that some characters typed ahead may be lost if the input device is a terminal.
Success: [eclipse]: tyi(input,Ascii). Ascii = 97 % press 'a' yes. [eclipse]: tyi(input,97). % press 'a' yes. [eclipse]: tyi(input,Ascii). Ascii = 4 % press ^D yes. Fail: [eclipse]: tyi(input, 0'b). % press 'a' no. Error: tyi(Stream,98). (Error 4). tyi(input, '98'). (Error 5). tyi(input, 98.0). (Error 5). tyi("string", A). (Error 5). [eclipse]: open(file1,update,s), write(s,p), > seek(s,0), tyi(s,Ascii), tyi(s,Ascii). (Error 190). tyi(9,A). (Error 192). tyi(atom,A). (Error 193).