X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Mon, 02 Feb 2004 20:52:52 +0200 From: "Eli Zaretskii" Sender: halo1 AT zahav DOT net DOT il To: djgpp AT delorie DOT com Message-Id: <7137-Mon02Feb2004205252+0200-eliz@elta.co.il> X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 In-reply-to: <401e4d56$1_2@127.0.0.1> (loneXwolfintj@pacXbell.net.remove.Xs) Subject: Re: How do I feed output of DOS commands into a program? References: <4017ddaa$1_6 AT Newsfeeds DOT com> <401e4d56$1_2 AT 127 DOT 0 DOT 0 DOT 1> 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 Precedence: bulk > From: "Robbie Hatley" > Newsgroups: comp.os.msdos.djgpp > Date: Mon, 2 Feb 2004 05:16:34 -0800 > > > > The only portable way to do it is with a batch file. > > Hmmm... how about a non-portable way? Even that might be > useful. A non-portable way involves chasing the DOS memory chain and modifying it when appropriate. I don't recommend that, what with the multitude of possible shell versions out there. Specifically , NTVDM might block this entirely (I didn't try, so I don't know). > 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. Perhaps; but it's hard to tell without knowing what problem, exactly, are you trying to solve.