Date: Wed, 28 Jan 1998 16:22:57 +0200 (IST) From: Eli Zaretskii To: Zippy cc: djgpp AT delorie DOT com Subject: Re: why won't my .exe program run properly until I set env var? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.