Mail Archives: djgpp/2004/02/02/08:44:22
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | "Robbie Hatley" <loneXwolfintj AT pacXbell DOT net DOT remove DOT Xs>
|
Newsgroups: | comp.os.msdos.djgpp
|
References: | <4017ddaa$1_6 AT Newsfeeds DOT com> <uad47l1b0 DOT fsf AT elta DOT co DOT il>
|
Subject: | Re: How do I feed output of DOS commands into a program?
|
Date: | Mon, 2 Feb 2004 05:16:34 -0800
|
Lines: | 48
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2800.1158
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2800.1165
|
Message-ID: | <401e4d56$1_2@127.0.0.1>
|
X-Authenticated-User: | $$-gw9vryh-3ijz759
|
X-Comments: | This message was posted through <A href
|
X-Comments2: | IMPORTANT: Newsfeed.com does not condone,
|
X-Report: | Please report illegal or inappropriate use to
|
Organization: | Newsfeeds.com http://www.newsfeeds.com 100,000+ UNCENSORED Newsgroups.
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
"Eli Zaretskii" <eliz AT elta DOT co DOT il> wrote in message news:uad47l1b0 DOT fsf AT elta DOT co DOT il...
> > 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.
Hmmm... how about a non-portable way? Even that might be
useful.
Batch files only seem to work for setting environmental variables if not
invoked from within a program. Otherwise, you end up with the same
thing: variables gone after program exits:
(program runs...)
int main(void)
{
system("MyFancyBatchFile.bat"); // set TEST=ASDF
return 0;
}
(...program exits)
Then type "set" at DOS prompt, and oops, the variable TEST
does not exist. :-(
Surely there's got to be a way around that dilemma.
--
Cheers,
Robbie Hatley
Tustin, CA, USA
loneXwolfintj AT pacXbell DOT net DOT remove DOT Xs
http://home.pacbell.net/earnur/
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
- Raw text -