Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!UTHSCSA.BITNET!BITNET From: BITNET@UTHSCSA.BITNET.UUCP Newsgroups: mod.computers.vax Subject: Direct input in C on vax Message-ID: <8703010449.AA20447@ucbvax.Berkeley.EDU> Date: Sat, 28-Feb-87 23:49:46 EST Article-I.D.: ucbvax.8703010449.AA20447 Posted: Sat Feb 28 23:49:46 1987 Date-Received: Sun, 1-Mar-87 17:15:47 EST Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 96 Approved: info-vax@sri-kl.arpa Subject: Direct input in C on vax > I cannot find a way to directly read input from the keyboard, character >by character. The routines I know of in C all require the user to hit >at the end of the line to signal to the computer that input is done. If there >is some way around this, I would greatly appreciate it. In this particular test program I was trying to read a delete character. It should at least get you started. In this test program I didn't deassign the channel. I don't have a system services manual here at home, and I don't remember the exact call. I think it is $deassign(channel), but I can't swear to it. Mark Moore Moore@UTHSCSA The University of Texas Health Science Center San Antonio, Texas 78284 ------------------------------------------------------------------------------- # include # include main() { int i; /* used to index loop */ char keypress; /* store character returned from termread */ short int channel; /* get term chan from $assign */ termchan(&channel); i = 20; do { termread(&channel,&keypress); printf("keypress = %c\n",keypress); if (keypress == 27 ) { printf("that was an escape\n"); } if (keypress == 127 ) { printf("that was most definitely a delete\n"); } i--; } while (i); } termchan(channel) short int *channel; /* must be a word. It won't work if */ /* you make it a long word. */ { int stat; /* store return status from sys calls */ char term[20] = " "; $DESCRIPTOR(dst,term); ctermid(term); stat = sys$assign(&dst,channel, 0, 0); } termread(channel,buffer) short int *channel; char *buffer; /* buffer for characters */ { int length; /* length of buffer */ int stat; /* store return status form sys calls */ length=1; stat = sys$qiow(0, /* event flag */ *channel, /* channel */ IO$_READVBLK+IO$M_NOECHO+IO$M_NOFILTR, /* function */ 0, /* iosb */ 0, /* astadr */ 0, /* astprm */ buffer, /* p1 */ length, /* p2 */ 0, /* p3 */ 0, /* p4 */ 0, /* p5 */ 0); /* p6 */ }