delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/07/20/01:30:14

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Fausto Arinos de A. Barbuto" <fbarbuto2002 DOT no AT w1 DOT ca DOT vip DOT scd DOT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Function kbhit()?
Date: Mon, 19 Jul 2004 23:21:00 -0600
Organization: Knights of the Round Table
Lines: 63
Message-ID: <2m3odtFhufc2U1@uni-berlin.de>
References: <2m3hjoFibqajU1 AT uni-berlin DOT de> <7494-Tue20Jul2004073651+0300-eliz AT gnu DOT org>
Mime-Version: 1.0
X-Trace: news.uni-berlin.de 1Oijjj3jSIzj4U7fWEoUhQgVrnoZFqyMGBK64Y3fXRCjdhHdNH
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Eli Zaretskii" <eliz AT gnu DOT org> wrote in message
news:7494-Tue20Jul2004073651+0300-eliz AT gnu DOT org...
> > From: "Fausto Arinos de A. Barbuto" <fbarbuto2002 DOT no AT w1 DOT ca DOT vip DOT scd DOT yahoo DOT com>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: Mon, 19 Jul 2004 21:24:39 -0600
> >
> >     I am porting an old C code to GCC. It works very well with Borland C 3.1
> >     and although it compiles and runs with gcc, it doesn't work as intended.
> >     After much tinkering with the code, I found out that the problem is in a
> >     statement that contains the kbhit() function. GCC didn't complain about
> >     it during compilation though, hence I assume that kbhit() exists in GCC
> >     -- it is I who can't use it properly. Any hints? Your help will be very much
> >     appreciated.

> Yes, DJGPP does have kbhit.  But without seeing the code and knowing
> what exactly do you mean by ``doesn't work as intended'' it is hard
> to tell what is wrong.

    Thanks for replying, Eli. The piece of code where kbhit() is being used is a
short function, as shown below:

void check_event(int *key)
{
    while (kbhit()) getch();
    *key = bioskey(0);
}

    Called at this program segment:

        [...]
        check_event(&cmd);
        p = toupper(cmd);
        if (p == 'R')
            return;
        if (p == 'A') {
            build_amort(v);
            display_amort();
            factor_header();
            aflg = 0;
            fflg = 1;
            return;
        }
        [...]

    It should then (in theory) capture a keyboard hit, make it uppercase
    and then decide what to do with the result.

    Now giving the code a closer look, it is quite possible that the error
    is due to the function bioskey(). Maybe.

    Thanks for any help.

---Fausto




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.716 / Virus Database: 472 - Release Date: 05/07/2004

- Raw text -


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