delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/02/04:05:14

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Beginner help wanted (getkey())
Date: Sun, 02 Nov 1997 11:28:47 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 35
Message-ID: <345C63EF.6121@cs.com>
References: <01bce6ec$a0b1abc0$LocalHost AT jbportable>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp229.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Johnny BARRAY wrote:
> 
> I code with djgpp for a few days now.
> 
> However, I have a strange pb with getkey() from pc.h.
> 
> This sample line stop my pc !! :
>   printf("%d ", getkey());
> 
> I'm using gcc 2.4.1.
                 ^^^
I hope that's a typo, and you meant gcc 2.7.2.1, which is the current
version of gcc being used by DJGPP v2.01.  If you really are using
2.4.1, you'd better upgrade.

getkey() waits for you to press a key, and then returns the value as an
integer.  I don't understand what you mean by "stop your pc;" have you
tried pressing a key?  Are you calling getkey() from an illegal context,
such as after installing a keyboard interrupt handler?  Are you
including the proper header files?  Otherwise, there's no reason for
this to happen.  If it does lock, can you break out with Ctrl-C or
Ctrl-Break?  Does Ctrl-Alt-Del work?  If you're running in Windows 95 or
Windows 3.1 have you tried running in DOS, or vice versa?

Please cut your code down to the smallest compilable program that causes
your computer to lock up, and post it so we can try to debug it.  Please
also tell us what operating system you are using.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Courage is the complement of fear.  |
|       aka Fighteer I       | A man who is fearless cannot be      |
|   mailto:fighteer AT cs DOT com   | courageous.  (He is also a fool.)"   |
| http://www.cs.com/fighteer |                    - Lazarus Long    |
---------------------------------------------------------------------

- Raw text -


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