G From:	CSBVAX::MRGATE!info-vax-request@kl.sri.com@SMTP 23-MAR-1988 09:32  To:	ARISIA::EVERHART6 Subj:	Re: Need single character input on VAX Pascal...    U Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Sun 20 Mar 88 15:22:57-PST , Received: by ucbvax.Berkeley.EDU (5.58/1.26)( 	id AA15069; Sun, 20 Mar 88 12:17:05 PST9 Received: from USENET by ucbvax.Berkeley.EDU with netnews . 	for info-vax@kl.sri.com (info-vax@kl.sri.com); 	(contact usenet@ucbvax.Berkeley.EDU if you have questions)  Date: 20 Mar 88 03:22:05 GMTD From: bsu-cs!mithomas@iuvax.cs.indiana.edu  (Michael Thomas Niehaus)1 Organization: CS Dept, Ball St U, Muncie, Indiana 9 Subject: Re: Need single character input on VAX Pascal...  Message-Id: <2418@bsu-cs.UUCP>2 References: <7787@cisunx.UUCP>, <2394@bsu-cs.UUCP># Sender: info-vax-request@kl.sri.com  To: info-vax@kl.sri.com   P In article <2394@bsu-cs.UUCP>, cfchiesa@bsu-cs.UUCP (Christopher Chiesa) writes:L > In article <7787@cisunx.UUCP>, bumpy@cisunx.UUCP (Michael Stopper) writes: > M > > Does anyone out there have a routine for VAX Pascal to read a single char L > > from the terminal in VAX Pascal without having to press the ever-presentM > > RETURN key??  I have a prog which prompts for a single character response   O > Yes.  Below you will find a MACRO Assembly routine which will do what you re- P > quest.  It may be called from any Vax/VMS programming language, including Pas-? > cal, without strenuous or obscure data-type-matching effort.    J Well, I wouldn't call using a BASIC subroutine and the corresponding data-K matching an obscure effort.  It would definitely be more understandable and L straight-forward to any programmer.  It's almost like you are bragging aboutG knowing MACRO.  (That would be like be bragging about knowing IBM S/370  Assembler.  Blah!)  > > To obtain a character:                 To obtain an integer:F > --------------------------------       _____________________________4 > [EXTERNAL]                              [EXTERNAL]N > PROCEDURE In_Char (VAR c:char);         PROCEDURE In_Char (VAR n: integer); 3 >   EXTERN;                                 EXTERN;  > / > To use it, of course, just invoke it by name:  > I >     In_Char(x);    (* 'x' gets the next character from the terminal. *)  >  > -- Chris Chiesa  [LONG MACRO program deleted]  8 Try using this BASIC routine to input a single character   Sub In_char(string a) H   a=inkey$(0%,wait)    ! 0% is the keyboard channel.  WAIT indefinitely. End Sub   G That's ALL of it.  Compile this with BASIC, then link it with your main @ program using the same 'char' PROCEDURE definition listed above.H If you want better, more complex, define a TYPE as VARYING[255] OF CHAR.F Substitute 'VAR c:Var_type' for the procedure parameter list, and alsoL declare a variable for the receiving end.  The only reason to go through allG of this trouble is the fact that the BASIC routine will return a 3 or 4 J character string that you can use any time someone presses a function key.I For example, if you press the GOLD key on a VT240, the BASIC routine will H return 'PF1'.  This goes for all of the other function/keypad keys also.   Hope this is helpful.    Michael Niehaus  Also from Ball State- UUCP: ..!{uunet,pur-ee,iuvax}!bsu-cs!mithomas  AppleLink: U0698