delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/23/11:45:17

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
Message-ID: <3C4EE228.CDCAD57B@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: kbhit()
References: <20020123105549 DOT 98938 DOT qmail AT web9101 DOT mail DOT yahoo DOT com>
Lines: 44
Date: Wed, 23 Jan 2002 16:30:50 GMT
NNTP-Posting-Host: 12.90.176.189
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1011803450 12.90.176.189 (Wed, 23 Jan 2002 16:30:50 GMT)
NNTP-Posting-Date: Wed, 23 Jan 2002 16:30:50 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

ROLAND wrote:
> 
> --- Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> wrote:
> > Something is wrong with the rest of your code:
> > kbhit() _is_ the function
> > you are looking for.  It returns immediately,
> > without waiting for a key
> > to be pressed.
> 
> This is what my code looks like:
> 
> if(kbhit()==0){

If you get here no key has been hit.  You probably wanted
(kbhit()) above.

>      if(getkey()==3){

Now that no key has been hit you want to get that non-existant
key.  I would expect the system to wait around for it.

>           interrupt();

Who knows what this does.  But it looks as if it doesn't return.

>      }
> }
> printf("Reading...\n");
> COMReadBufferTimed(DJGPPdev,anmes,NULL,256,&charsin,1000);
> 
> I know that the program doesn't work, 'cause I never
> see the "Reading..." on the screen. It also doesn't go
> to interrupt, 'cause then the progam has to stop
> (interrupt closes the port and exits)...
> What is the problem with my code???

It is faulty.  See above.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   (Remove "XXXX" from reply address. yahoo works unmodified)
   mailto:uce AT ftc DOT gov  (for spambots to harvest)

- Raw text -


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