Mail Archives: djgpp/2004/07/20/01:30:14
"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 -