From: beyonddeath Newsgroups: comp.os.msdos.djgpp Subject: Re: using keyboard not line buffered Message-ID: <27uudsce1g54pujkb3a7ajam89n1g7d0h8@4ax.com> References: <200003270139 DOT GAA00835 AT midpec DOT com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 51 Date: Mon, 27 Mar 2000 13:07:40 GMT NNTP-Posting-Host: 24.112.65.173 X-Complaints-To: abuse AT home DOT net X-Trace: news2.rdc1.on.home.com 954162460 24.112.65.173 (Mon, 27 Mar 2000 05:07:40 PST) NNTP-Posting-Date: Mon, 27 Mar 2000 05:07:40 PST Organization: @Home Network Canada To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Thanks, i found libkb which seems to work for what i need, getch on my system seems to wait for me to enter a key each time through the loop which is not what i need it for. Thanks anyway On Mon, 27 Mar 2000 06:39:29 +0500, tr AT midpec DOT com (Prashant TR) wrote: >beyonddeath proclaimed: > >> what i need to do is allow my programs to use the arrowkeys and all >> other buttons while ignoring others for example >> >> i want this while loop to continue forever until enter is hit >> >> while(!keys() == ENTER) >> { >> printf("hit enter"); >> } >> >> If you can help great thanks im looking more for source cause its >> already been explained lots of times and i dont know assembler. >> > >Ok. Check this out (untested code) > >#include >#include > >#define ENTER 13 > >int main() >{ > int key = 0; > > while (key != ENTER) { > key = getch(); > if (!key) { > key = getch(); > switch (key) { > case 'H': printf("UP\n"); break; > case 'P': printf("DOWN\n"); break; > case 'K': printf("LEFT\n"); break; > case 'M': printf("RIGHT\n"); break; > } > key = 0; > } > } > return 0; >}