Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!daver!dlb!netcomsv!rcb From: rcb@netcom.COM (Roy Bixler) Newsgroups: comp.sys.atari.st.tech Subject: Re: Getting ASCII value from scancode Keywords: Progammingm, C Message-ID: <1991Apr27.053612.24946@netcom.COM> Date: 27 Apr 91 05:36:12 GMT References: <1991Apr26.232519.12216@zip.eecs.umich.edu> Distribution: all Organization: Netcom - Online Communication Services UNIX System {408 241-9760 guest} Lines: 38 In article <1991Apr26.232519.12216@zip.eecs.umich.edu> heavy@zip.eecs.umich.edu (Richard Scott Hall) writes: >I am having a problem. It is quite easy to get the scancode >for a key being pressed (by using evnt_keybd/envt_multi), but >it is a little harder if you just want the ASCII value. For >instance: > > it is possible to press any ALT+ sequence in my program. > When I get a keyboard event, I get the keyboard state from > vq_key_s() (i.e. shift/control/alt), but I get the scancode > from evnt_keybd/multi. So i guess what I am asking, is there > anyway to go from scancode to ASCII without having to define > all the values in my program? When you press 'normal' keys (without ALT), the ASCII code is in the least significant byte of the scan-code. With ALT, the least significant byte is 0. So, it looks like getting the ASCII would involve a table which maps the most significant byte of the scan-code to ASCII. Unfortunately, this scan-code byte is based on the QWERTY positioning of the keys. It's true that it would be nice if the non-ASCII code for ALT keys were, say, the same least significant 7 bits (as the corresponding ASCII character) with the 8'th bit set, but ... After all, why make it hard on the people who write typing tutors? > >Richard Hall >University of Michigan >-- > >Standard disclaimer: I am not me, I am who you think you are... > so don't blame me. -- Roy Bixler rcb@netcom.com -or- (UUCP) uunet!apple!netcom!rcb "Just when you think you know it all, it changes!"