Mail Archives: djgpp/2004/07/21/11:31:07
"Eli Zaretskii" <eliz AT gnu DOT org> wrote in message:
> > 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 23:21:00 -0600
> >
> > void check_event(int *key)
> > {
> > while (kbhit()) getch();
> > *key = bioskey(0);
> > }
> If this function is entered when a keypress is waiting in the BIOS
> keyboard queue, then `getch' will eat up that keypress and `bioskey'
> will wait until the next keypress and return that. Does this explain
> the misbehavior you see (which you still didn't describe)?
Hi Eli;
Sorry, I was out of town yesterday. Let me explain what the misbehaviour
is: the program, when executed, receives a numerical input (an interest
rate) and after that (and here is the point where things get completely
screwed) an input that will define whether the compounding period is
annual or monthly. This is done by pressing either "A" or "a" for annual
or, alternatively, "M" or "m" for monthly. No other input is accepted
and
the program doesn't go ahead until one of the four letters above is
entered. It works beautifully with Borland C++, but not with GCC.
What you say about getch() makes sense (I reckon), but things don't
get any better if I remove it.
I found a way to circumvent this problem by rewriting the piece of code
where the compouding period is entered, identified and checked. But
I am not happy with the solution I came up with. Firstly, because I'm
still totally at sea as to why the code does not work with GCC. 2nd,
because what was an otherwise very elegant function (check_event)
has been replaced by seven ugly lines of code. Ah well. I guess I
will never know what the problem is.
Thanks for your help.
---Fausto
- Raw text -