TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CHRISTOPHER BUTLER
from: GABOR MANIC
date: 1997-07-06 19:01:00
subject: Help me!

 Christopher Butler said about Help me!....
 CB> I've got a program here, and it compiled fine a while ago, then I left
 CB> it for a bit... I've come back to it, and it crashes when it tries to
 CB> do a getch()! 
 CB> A bit of code that it crashes on:
 CB> char i;
 CB> if (inp(0x64) & 1)  // same as kbhit()
        ^^^^^^^^^^^^^^^
        The problem is here
Here you set the first bit if it is already set, and erase the others.
This port can't be changed, and that is the reason why your computer
crashes.
If you want a chack the state of N-th bit you can do that like this:
... (inp(0x64) && 1)
& - binary AND operator
&& - logical AND operator
 CB> i = getch();
 CB> else
 CB> i = 0;
 CU, Gaby
... GPF - the Microsoft Award for Programming Exellence..
--- FMailX 1.22
---------------
* Origin: Tipp-Topp System, Subotica, Yugoslavia (2:37/10)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.