delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/24/13:04:16

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: "Linux Dr." <usenet AT haughtmail DOT com>
Subject: Re: Non-blocking keyboard I/O in Cygwin?
Date: Tue, 24 Feb 2004 18:03:54 +0000 (UTC)
Lines: 20
Message-ID: <loom.20040224T185045-57@post.gmane.org>
References: <loom DOT 20040223T162304-686 AT post DOT gmane DOT org>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: main.gmane.org
User-Agent: Loom/3.14 (http://gmane.org/)
X-Loom-IP: 134.253.26.6 (Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0)

Linux Dr. <usenet <at> haughtmail.com> writes:

> 
> I have a non-blocking keyboard I/O routine I've used for years under IRIX,
> Solaris and Red Hat linux.  It doesn't seem to work under cygwin, however.  The
> core of it is:
> 

Ok, I figured this out on my own... though it gave me a headache.  I wrote a
getch() which immediately returns a -1 if no input is waiting, or the ascii
value of the key if previously pressed.  It's non-blocking and no "enter" or
return key press is necessary.  Can be easily modified for echo or non echo,
blocking or non-blocking, and can count the number of keystrokes stored in the
input buffer without de-queueing them.  I'm happy to share... just send me an
email.  Compiles but doesn't back-port (run) correctly on linux or solaris. 
However, I have seperate versions for those machines, too.  This solution DOES
NOT REQUIRE curses/ncurses.  It works from shell scripts, as well.  Neall 





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019