chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Reading from STDIN with the hang


From: Alexej Magura
Subject: [Chicken-users] Reading from STDIN with the hang
Date: Mon, 31 Mar 2014 15:24:04 -0600

K, so I’m currently working on an application that, if the user doesn’t provide any options/operands, reads from STDIN, like GNU cat.  I just finished adding signal-handling for SIGINT (Ctrl-c), however, now whenever I press Ctrl-c nothing happens because (read-char) hangs until I press enter.  Is there a way to use (read-char) that won’t make it hang?  Maybe something like: (if (not-null? (peek-char)) (read-char))?  I saw that (char-ready?) is supposed to prevent the next call to (read-char) from hanging, but (while I’m sure that (char-ready?) in fact works) I can’t seem to get it to work.  

Anyone have any experience with this kind of issue; would using (read-line) instead of (read-char) make a positive difference?  (I doubt it would)
-- 
Alexej Magura
Sent with Airmail

reply via email to

[Prev in Thread] Current Thread [Next in Thread]