Re: keyboard input from ISIS

From: <rgibson_at_email.domain.hidden>
Date: Fri, 26 Oct 2007 21:45:57 -0400
Spiffy, thanks.

Rob


Quoting "John E. Davis" <davis_at_email.domain.hidden
> rgibson_at_email.domain.hidden>> I want to capture keystrokes from the keyboard.  (I wasn't clear... 
>> not trying
>> to save to a log file.)  I want to do something a bit interactive, like:
>>
>> while (key = getkey() != 'Q') {
>>    if (key = 'P') () = printf("Hello\n");
>>    ...
>> }
>
> isis> .load ./getkey.sl
> isis> x = getkey ();
> isis> !cat getkey.sl
> define getkey ()
> {
>   () = system ("stty raw");
>   variable ch;
>   if (1 != read (fileno(stdin), &ch, 1))
>     ch = 0;
>   () = system ("stty sane");
>   return ch;
> }
>
> --John
> ----
> You received this message because you are
> subscribed to the isis-users list.
> To unsubscribe, send a message to
> isis-users-request_at_email.domain.hidden> with the first line of the message as:
> unsubscribe
>
>
Received on Fri Oct 26 2007 - 21:46:03 EDT

This archive was generated by hypermail 2.2.0 : Sat Oct 27 2007 - 06:45:40 EDT