🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #1412

getch() + Ctrl-C == locked program

#1412
From: Dennis Yelle
Date: Fri, 04 Sep 1992 20:35
36 lines
1262 bytes
#if 0
When I compile this program with:
    icc /B"/st:0x08000" /Sm getch.c
and run it with:
    getch
It works OK unless I type a Ctrl-C.

If I type a Ctrl-C the program locks up and ignores all
other characters, and I can not get rid of the program.

I do not care if getch() returns the control-c to me or not,
but I do not want it to hang.

Can anyone help me with this problem?
#endif

#include <conio.h>
#include <stdio.h>
#include <stdlib.h>

main( int argc, char **argv)
{
        int c;
        
        argc = argc;
        argv = argv;
        
        printf( "Please press a key>");
        fflush( stdout);
        c = getch();
        printf( "\n" "thanks for the 0x%02X.\n", c);
        return 0;
}

--
Dennis Yelle (bbs.dennis@tsoft.sf-bay.org)
Technical Details
Message-ID: <uDgLqB2w165w@tsoft.sf-bay.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!olivea!sgigate!sgiblab!tsoft!dennis

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pmafire!news.dell.com!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!olivea!sgigate!sgiblab!tsoft!dennis
From: bbs.dennis@tsoft.sf-bay.org (Dennis Yelle)
Newsgroups: comp.os.os2.programmer
Subject: getch() + Ctrl-C == locked program
Message-ID: <uDgLqB2w165w@tsoft.sf-bay.org>
Date: 4 Sep 92 20:35:29 GMT
Sender: bbs@tsoft.sf-bay.org (BBS User)
Organization: The TSoft BBS and Public Access Unix, +1 415 969 8238
Lines: 36