From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c4b62bb22cdbc161 X-Google-Attributes: gid103376,public From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk) Subject: Re: Troubles : New_Page & Get_Immediate Date: 1997/10/18 Message-ID: <877158990.60snx@jvdsys.nextjk.stuyts.nl>#1/1 X-Deja-AN: 281406548 Distribution: world References: <01bcdae4$3f70ffa0$0f02000a@default> Organization: *JerryWare HQ*, Leiden, Holland Newsgroups: comp.lang.ada Date: 1997-10-18T00:00:00+00:00 List-Id: In article <01bcdae4$3f70ffa0$0f02000a@default> bjyxxl@echidna.stu.cowan.edu.au writes: >The LRM states that Get_Immediate can be used to get a character from the >keyboard immediately ie. without the enter key. But says should be used >with 'unbuffered' input. Are there any references or suggestions as to >how to do low_level IO or 'unbuffered' input to do this. End goal to have >something like the well known 'hit any key to continue'. As this was asked twice: a) Get_Immediate comes in two flavors: blocking and non-blocking. The blocking form waits until a key is pressed befor returning The non-blocking form returns immediately, reporting if a keypress was detected. Here's a simple example of both: with Ada.Text_IO; use Ada.Text_IO; procedure Test is C : Character; Available : Boolean := False; begin -- Waiting for a key pressed - blocking Put ("Press almost any key to continu: "); Get_Immediate(C); New_Line; Put_Line ("Ok, continuing..."); -- Polling for a key pressed - non-blocking Put ("Again waiting for some keypress: "); While not Available loop -- Do useful things here Get_Immediate (C, Available); end loop; New_Line; Put_Line ("Ok, thanks for pressing a key."); end Test; The buffered/unbufferd issue gives a compiler the option of not implementing this, but wait for an Enter key to be pressed first. Fortunately for you, both OA Special and GNAT support the (IMHO) proper behavior with their Win95/NT compilers. -- -- Jerry van Dijk | Leiden, Holland -- Consultant | Team Ada -- Ordina Finance | jdijk@acm.org