www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/20/10:22:38

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Fustrated person ranting about text input
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <sk2ufssnj82t6viek38dcqo7sgcqioa1lb@4ax.com>
References: <8djplv$27o$1 AT news6 DOT svr DOT pol DOT co DOT uk>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 42
X-Trace: +r9wQzXzi+T+6nVgOTRLYX/K0RQP6Lp4nlsu6txjBidH5amTmCKg7jei1/mKjmzXoU2B3U2wtRxy!V4r1r7LfF2BV59eoC83oPUH5BnhsUWpciITgO8ZqYD4m78l7Hx3DKWxh1BkRBSMffFpztcWGcMLE!HOZJPQ==
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Thu, 20 Apr 2000 13:50:09 GMT
Distribution: world
Date: Thu, 20 Apr 2000 13:50:09 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Wed, 19 Apr 2000 08:30:51 +0100, "Edward Griffin"
<edward AT neptune DOT greatxscape DOT net> wrote:

>I'm writting a server program for a network game and I need to write my own
>custom text input function. The program runs in text mode so I don't need
>any graphical stuff. It currently handles IPX packets and sends them to
>other computers on the network. When it's not doing that, I want it to be
>checking for keypresses, and if it gets one, add the letter to a string, and
>display the text on the screen.
>
>It also needs to understand delete, pgup, pgdn, enter and esc seperately.
>How should I go about doing this? There are so many functions like getch,
>kbhit, getche, putchar, getchar etc. I've tried hundreds of combinations and
>I can't get it to work.

#include <conio.h>

while(mainloop)
{
  int kee;

  if(kbhit()) /* we got a key */
  {
    kee = getch();
    if(kee == 0) // we got an extended key
      kee = getch() << 8;
    switch(kee)
    {
    case FOO:
      break;
    case BAR:
      break;
  }
}

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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