www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/28/09:23:30

Date: Wed, 28 Jan 1998 16:22:57 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Zippy <spark AT es DOT co DOT nz>
cc: djgpp AT delorie DOT com
Subject: Re: why won't my .exe program run properly until I set env var?
In-Reply-To: <spark-2901980201090001@p113-thalia.es.co.nz>
Message-ID: <Pine.SUN.3.91.980128162026.4496F-100000@is>
MIME-Version: 1.0

On Thu, 29 Jan 1998, Zippy wrote:

> main(int argc, char *argv[])
> {
>    char *d, *p, *n, *e;
>    int dummy = fnsplit(argv[1], d, p, n, e);            
>  /* This splits a filename into drive, path, name and extension. */
> 
>    dummy = rename("oldname.txt", strcat(n, ".txt"));
> }

The varaibles d, p, n, and e all point into the blue, since they were not
initialized to point to some allocated space.  Programs with such bugs can
have some real wierd behavior depending on environment where they run. 

> Now, this is what I don't understand.  Why do I need to set the variable
> when I am running the stand-along .exe file?

No, you just need to debug your program when something like that occurs.

- Raw text -


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