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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,37c1f61bd0b7914 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!s19g2000prg.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Converting Type Characters to type string Date: Mon, 31 Mar 2008 15:33:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <8f5967a7-17ab-4eda-80fc-5cb58ae011f5@s50g2000hsb.googlegroups.com> <2d291584-9cb9-4a3f-8626-7b7066e60566@59g2000hsb.googlegroups.com> <5052229e-61c3-401d-93b6-a95edee29e58@m71g2000hse.googlegroups.com> <76c5beff-f3e9-44ae-ab96-7da01ea17a65@s37g2000prg.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207002825 25076 127.0.0.1 (31 Mar 2008 22:33:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 31 Mar 2008 22:33:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s19g2000prg.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20691 Date: 2008-03-31T15:33:45-07:00 List-Id: On Mar 31, 1:26 pm, Maciej Sobczak wrote: > On 31 Mar, 17:41, Adam Beneschan wrote: > > > I almost never use single-character input. The only time I would want > > to is if, for some reason, you need the program to react immediately > > to some key that's typed in (other than Return or Enter). E.g. I've > > written programs that will do something interesting if the user > > presses the up-arrow or down-arrow keys on the keyboard. > > How did you do this? > Normally, the operating system (the terminal, actually), isolates the > process from all such things and feeds the complete line of text to > the process' input queue *after* it is committed by Enter. The program > has no way to react to individual keystrokes. No, any decent OS would provide a way to input immediate keystrokes. On Linux, I think it involves a call to either ioctl() or tcsetattr()---I don't remember---to turn off the OS's complete-line handling. As Georg pointed out, Get_Immediate is available in Ada to do this for you. Actually, I may have written this program before Ada 95 was available, which meant that Get_Immediate wasn't available, so something tricky had to be done. But my program still uses Text_IO.Get. Of course, whatever I did is non-portable. Anyway, I'm a bit sorry I mentioned this, because it has nothing to do with the point I was trying to make. -- Adam