delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/14/21:43:22

From: "The Advisor" <TheAdvisor AT cadvision DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <382f603a AT news DOT cadvision DOT com>
Subject: Re: SIGSEGV - oh how we love you
Date: Sun, 14 Nov 1999 18:24:53 -0700
Lines: 46
Organization: Anarchy Incorporated
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 207.148.132.50
X-Original-NNTP-Posting-Host: 207.148.132.50
Message-ID: <382f6169@news.cadvision.com>
X-Trace: 14 Nov 1999 18:27:05 -0700, 207.148.132.50
X-Original-NNTP-Posting-Host: 204.50.1.43
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hmm... what a coincidence, just after I posted this I stumbled upon the
answer... I put an if(keypressed()) { } around the entire readkey and
switch, and this works... anybody know why you have to use keypressed()?
Isn't readkey() supposed to wait for a keypress?.. hmm


The Advisor <TheAdvisor AT cadvision DOT com> wrote in message
news:382f603a AT news DOT cadvision DOT com...
> From The Advisor- TheAdvisor AT cadvision DOT com ...
>
> Can anybody help me figure out why I'm getting a SIGSEGV?
>
> Okay here's a snippet of my program: ( this is in a loop to constantly get
> keys from the user and store them in a linked list... )
>    int ch;
>    ch = readkey();
>    switch(ch >> 8) {
>        case KEY_ENTER: { printf("\n"); break; }
>        default: { if(((ch & 0xff) >= 32) && ((ch2 & 0xff) <= 255))
>  printf("%c", (ch & 0xff)); }
>       }
>
> Shutting down Allegro
> Exiting due to signal SIGSEGV
>
> General Protection Fault at eip=00001796
> eax=ffffffff ebx=00008454 ecx=000ca7a4 edx=000ca790 esi=00000054
> edi=0004a370
> ebp=000ca300 esp=000ca2e8 program=D:\PROGRAMS\CEDIT\TEST\CHARTEST.EXE
> cs: sel=00a7  base=84547000  limit=fed80fff
> ds: sel=00af  base=84547000  limit=fed80fff
> es: sel=00af  base=84547000  limit=fed80fff
> fs: sel=00c7  base=00000000  limit=0010ffff
> gs: sel=00c7  base=00000000  limit=0010ffff
> ss: sel=00af  base=84547000  limit=fed80fff
> App stack: [000ca370..0004a370]  Exceptn stack: [0004a250..00048310]
>
> Call frame traceback EIPs:
>   0x00001796
>   0x00001f44
>   0x000285ae
>
>
>


- Raw text -


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