www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/11/09:45:37

From: viktor DOT lundstrom AT mailbox DOT swipnet DOT se (Viktor Lundstrom)
Newsgroups: comp.os.msdos.djgpp
Subject: strange error
Date: Fri, 10 Apr 1998 21:24:20 GMT
Organization: A customer of Tele2
Lines: 22
Message-ID: <352e8c65.2654329@nntpserver.swip.net>
NNTP-Posting-Host: nn1.swip.net
Mime-Version: 1.0
Cache-Post-Path: nn1!s-13642 AT dialup207-3-52 DOT swipnet DOT se
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I receive a General Protection Fault when calling sprintf() - but only

if I have run another function before. Here´s the code : 

void abc(int nr)
{
char tstr[50];

... some strcpy/strcat´s 
sprintf(tstr, "%d", nr); <- General Protection Fault
}

The error only occurs if I have run another function before (a sort of
menu-system... it uses some inline asm functions (but these functions
are used elsewhere throughout the game)).

I assume that the error lies in that I clobber some register or
something somewhere before... Is there anything special I should
think about when doing inline asm? (for example, is it possible
to declare any clobbered segment-registers?)


- Raw text -


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