www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/28/03:06:08

Newsgroups: comp.os.msdos.djgpp
From: manfred DOT heumann AT uni-bielefeld DOT de (Manni Heumann)
Subject: Re: Key press in ASCII
References: <7l5mhn$h9q$1 AT orudios DOT magnet DOT at>
X-Newsreader: News Xpress 2.01
Date: Sun, 27 Jun 1999 18:00:54 GMT
NNTP-Posting-Host: ppp36-41.hrz.uni-bielefeld.de
Message-ID: <377666d8.0@news.uni-bielefeld.de>
X-Trace: 27 Jun 1999 20:00:56 +0200, ppp36-41.hrz.uni-bielefeld.de
Lines: 28
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <7l5mhn$h9q$1 AT orudios DOT magnet DOT at>, "Mark Usher" <marku AT magnet DOT at> wrote:
>Is there a function available that will give me the ascii value of a key
>press back ? If not, is there an easy way to convert the key press returned
>from getkey() to it's ASCII value.
>
>Basically I am trying to add the key pressed to a string without having to
>press return.
>ie
>    key = getkey()
>    strcat(kbdbuffer, ASCII(key)
>
>Mark
>marku AT magnet DOT at
>
>
In C this is very simple, you don't need an extra function:
key = getkey ();
printf ("ASCII value: %d", (int) key);

I wouldn't work with strcat() in this case, because it expects a char pointer. 
Why don't you just use an index into your array?
kbdbuf[x]=key;


--

Manni

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019