delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/01/29/02:46:54

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: 29 Jan 2004 08:24:35 +0200
Message-Id: <uad47l1b0.fsf@elta.co.il>
From: Eli Zaretskii <eliz AT elta DOT co DOT il>
To: djgpp AT delorie DOT com
In-reply-to: <4017ddaa$1_6@Newsfeeds.com> (nathankreiger@hotmail.com)
Subject: Re: How do I feed output of DOS commands into a program?
References: <4017ddaa$1_6 AT Newsfeeds DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: "Nathan Kreiger" <nathankreiger AT hotmail DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Wed, 28 Jan 2004 08:06:18 -0800
> 
> I ran PROG1 and set the variable to "One, two, three, test.",
> but when PROG2 trys to read the variable, it's already gone.
> (Garbage collection at work?)

This happens because the environment variables set by PROG1 are gone
when PROG1 exits (they live in a block of memory that is allocated
for PROG1 and deallocated when PROG1 exits).

> Is there a way to set environmental variables so that they stay put
> even when the program that set them terminates?

The only portable way to do it is with a batch file.

- Raw text -


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