Xref: utzoo comp.os.vms:33580 comp.lang.c:34778 rec.games.programmer:2696 Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!elroy.jpl.nasa.gov!jarthur!nntp-server.caltech.edu!juliet.caltech.edu!gceych From: gceych@juliet.caltech.edu (Eychaner, Glenn C.) Newsgroups: comp.os.vms,comp.lang.c,rec.games.programmer Subject: Re: VAX-C immediate char reading Keywords: VAX-C VMS i/o immediate Message-ID: <1990Dec14.195737.22164@nntp-server.caltech.edu> Date: 14 Dec 90 19:43:43 GMT References: <1990Dec14.191104.7874@athena.mit.edu> Sender: news@nntp-server.caltech.edu Reply-To: gceych@juliet.caltech.edu Distribution: na Organization: California Institute of Technology Lines: 54 News-Software: VAX/VMS VNEWS 1.3-4x Nntp-Posting-Host: juliet.caltech.edu In article <1990Dec14.191104.7874@athena.mit.edu>, seaotter@athena.mit.edu writes... > >Another question I'm sure has been posted before... > >Is there a way under VMS 5.x using Curses (yes, NOT smg$stuff) >to write some function next_avail_char() such that I could write >a code fragment like > > for(;;) { > if ((c = next_avail_char()) != '\0') { > dostuff(); > } else { > update_something(); > } > } > >In other words I need to know if there is input waiting and if so, >what it is. > >Post or email c/o seaotter@athena.mit.edu or mzraly@ldbvax.dnet.lotus.com >The MIT address is probably better, though. > > >Thanks, > Mike > > > >-- > >| Mike Zraly | You should never wear your best trousers | >| | when you go out to fight for freedom and | >| via: seaotter@athena.mit.edu | liberty. -- Henrick Ibson | I wanted to post this to see what OTHER people have gotten...my solution is really weird. I found that if I ABSOLUTELY COVERED stdscr with windows, performed a nocrmode() and a noecho(), and then tried a getch() or getstr() (I believe those are the calls), I get the type of behaviour you described. However, I found it difficult to actually enter a key, and it ate up CPU like a demon. I don't recommend this at all. I eventually gave up on it. BTW, according to my CURSES manual, the functions raw() and noraw() are supposed to return after something like 5 seconds OR a key is pressed. I ended up calling SMG$CREATE_VIRTUAL_KEYBOARD and SMG$READ_KEYSTROKE. These also allow you to read the function keys and arrows and numeric keypad in applications mode. In fact, some of my programs are rapidly becoming curses/smg$ hybrids...seems safe enough as long as you're careful, i.e. use only one of them for terminal screen output (I hate string descriptors and passing lots of things by reference). Glenn Eychaner |Eychaner@SunCub.Caltech.edu |Remember: It is easier to ride a 40386 N Shore Ln |gceych@iago.caltech.edu |camel through the eye of a needle Big Bear City, CA| Big Bear Solar Observatory |than to drive a Buick through the 92314| !*** G O N I N E R S ***! |hole in a doughnut.