Date: Mon, 27 Mar 2000 06:39:29 +0500 Message-Id: <200003270139.GAA00835@midpec.com> From: tr AT midpec DOT com (Prashant TR) To: djgpp AT delorie DOT com In-reply-to: (message from beyonddeath on Sun, 26 Mar 2000 16:00:19 GMT) Subject: Re: using keyboard not line buffered References: Reply-To: djgpp AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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; }