delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/01/08:31:45

From: Martin DOT Stromberg AT lu DOT erisoft DOT se (Martin Stromberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: sscanf() fluffs my program up !
Date: 1 Sep 1999 08:21:10 GMT
Organization: Ericsson Erisoft AB, Sweden
Lines: 29
Message-ID: <7qinlm$1qi$3@antares.lu.erisoft.se>
References: <199908311813 DOT TAA06418 AT burdock DOT restall DOT net>
NNTP-Posting-Host: spica-144.lu.erisoft.se
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Peter Restall (pete AT restall DOT net) wrote:

: Hi.  I was just wondering whether there are any bugs in the 'sscanf()'
: library routine for DJGPP ?  See, I've got some code that looks like this:
:         sscanf(modedef, "%[^:]:%dx%d:%d:%d:%X:%X:%X",
:                mode->name,
:                (unsigned int *) ((u_shortint *) &mode->width),
:                (unsigned int *) ((u_shortint *) &mode->height),
:                (unsigned int *) ((u_shortint *) &mode->depth),
:                (unsigned int *) ((u_shortint *) &mode->flags),
:                (unsigned int *) ((u_shortint *) &seg),
:                (unsigned int *) ((u_shortint *) &off),
:                (unsigned int *) ((u_shortint *) &mode->num));

[Klippa, klapp, kluppit.]

: I've tried taking away the casts, but it still doesn't work.  I've narrowed
: the problem area down to where I read the hex variables with '%X' --
: everything else can be read without corrupting the file-handle, but as soon
: as a single '%X' is parsed, my code pukes.  No run-time or compile-time
: errors (I compiled with '-Wall -pedantic -O3 -ffast-math').

Well, remove the casts and compile with "-Wall". I think you'd get quite a 
lot of warnings, yes? Correct them.


Pink Floyd, The Division Bell,

							MartinS

- Raw text -


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