chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] Fw: Re: Reading from STDIN with the hang


From: Alexej Magura
Subject: [Chicken-users] Fw: Re: Reading from STDIN with the hang
Date: Sun, 6 Apr 2014 11:57:16 -0600

At the present, my current plan is to try rolling my own (read-char) in C, 
since the one that comes with Chicken Scheme hangs until it sees a carriage 
return.  I’m surprised, however, that we don’t already have constructs or 
what-have-you in place to allow for buffered IO.  Is this implemented by-design 
or just a coincidence, or is it (as I fear) part of the Scheme standard, since 
Guile Scheme exhibits the same before?

--  
Alexej Magura
Sent with Airmail

On April 1, 2014 at 8:56:17 AM, Alexej Magura (address@hidden) wrote:
> Compiled. Oh, and even if was interpreted, I have my shebang set to 
> #!/usr/bin/env csi  
> -qn.
> --
> Alexej Magura
> Sent with Airmail
>  
> On April 1, 2014 at 2:17:37 AM, Christian Kellermann (address@hidden) wrote:  
>  
> Hi Alexej,
>  
> * Alexej Magura [140331 23:24]:
> > 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)
>  
> Is this compiled code or interpreted code? If it is run in the
> interpreter it might be that some module you load snatches sigint
> from you. Parley is one of the candidates and maybe I should change
> that behaviour. You can instantly try this by running your csi with
> the (-n) switch which will prevent loading anything from .csirc.
>  
> Kind regards,
>  
> Christian
>  
> --
> May you be peaceful, may you live in safety, may you be free from
> suffering, and may you live with ease.
>  




reply via email to

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