delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/01/09:59:04

Date: Tue, 1 Jul 1997 16:55:35 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: DrkWatr <pawn AT dialnet DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Newbie question
In-Reply-To: <01bc861c$7c3537c0$b5fa41ce@drkwatr>
Message-ID: <Pine.SUN.3.91.970701165040.25613C-100000@is>
MIME-Version: 1.0

On 1 Jul 1997, DrkWatr wrote:

> frame_skip = atoi (arg_temp[2]);
                     ^^^^^^^^^^^
This should be "&arg_temp[2]" or "arg_temp+2".  `atoi' needs a pointer to 
a string, whereas arg_temp[2] is the 3rd character of the string, not a 
pointer.  Dereferencing arg_temp[2] should really crash your program if 
you run it on plain DOS (no Windows), since CWSDPMI, the free DPMI server 
bundled with DJGPP, aborts any program that attempts to dereference 
pointers with obviously bigus values.

> printf ("%s",arg_temp[1]);

Same error here.  Either use &arg_temp[1] or arg_temp+1, or replace %s 
with %c if you want to print a single character.

- Raw text -


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