hamilton@motcid.UUCP (Danial Hamilton) (04/17/91)
My son programs using Turbo Pascal, and would like to pass a value from his Pascal program to another program via a DOS environment variable. Can he do this? Can someone tell him how? He knows how to set the errorlevel, and could accomplish his goal that way, but it is not as elegant of a solution as he would like. Any help out there?
bobb@vice.ICO.TEK.COM (Bob Beauchaine) (04/22/91)
In article <4744@ash54.UUCP> hamilton@motcid.UUCP (Danial Hamilton) writes: >My son programs using Turbo Pascal, and would like to pass >a value from his Pascal program to another program via a >DOS environment variable. Can he do this? Can someone >tell him how? He knows how to set the errorlevel, and could >accomplish his goal that way, but it is not as elegant of a >solution as he would like. Any help out there? The discussion on permanently changing an environment variable was on this group some time ago; sorry, I can't refer you to an article, but perhaps someone else can. Be warned; the topic is probable more advanced than you think. Another scenario you might consider is using the Dos interprocess communication area. Any good text on the inner workings of MS-DOS will contain an explanation. The one I know of is Peter_Norton's_ Guide_to_the_IBM_PC. /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ Bob Beauchaine bobb@vice.ICO.TEK.COM C: The language that combines the power of assembly language with the flexibility of assembly language.
CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (04/23/91)
In article <4744@ash54.UUCP>, hamilton@motcid.uucp (Danial Hamilton) wrote: >My son programs using Turbo Pascal, and would like to pass >a value from his Pascal program to another program via a >DOS environment variable. Can he do this? Can someone [...remainder deleted...] (I find that I cannot reach @motcid.uucp from my site, so I am posting here.) Unfortunately, it is much easier to _get_ the value of environment variables in Turbo Pascal than it is to _set_ them. You will find a set of PD units from TurboPower Software available as PD1:<MSDOS.TURBOPAS>BONUS507.ARC,1,150435,8,900205, "Misc. TP 4/5 utilities/pgms from TurboPower" on Simtel and mirrors. It contains a unit called TPENV which provides many capabilities relating to environment variables. I'd suggest you download it and go from there. If you can't get the entire file, I can email you an excerpt I made specially for net postings, but you would do well to grab the entire thing. (NOTE: it appears that you'll have to give me a Bitnet-accessible address if I am to email you.) It is _real_ PD stuff, and although it is written to accompany TurboPower's commercial library, it is easy to use on its own. Cheers-- --Karl +====================================================================+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta GA 30093 USA | | Home of Epi Info 5.0 | +====================================================================+
milne@ics.uci.edu (Alastair Milne) (04/23/91)
In <7333@vice.ICO.TEK.COM> bobb@vice.ICO.TEK.COM (Bob Beauchaine) writes: >In article <4744@ash54.UUCP> hamilton@motcid.UUCP (Danial Hamilton) writes: >>My son programs using Turbo Pascal, and would like to pass >>a value from his Pascal program to another program via a >>DOS environment variable. Can he do this? Can someone >>tell him how? He knows how to set the errorlevel, and could >>accomplish his goal that way, but it is not as elegant of a >>solution as he would like. Any help out there? > The discussion on permanently changing an environment variable > was on this group some time ago; sorry, I can't refer you to > an article, but perhaps someone else can. Be warned; the topic > is probable more advanced than you think. Somebody posted a unit that was supposed to do this safely. Unfortunately I missed it :-( :-(. The trick is to add the variable to the environment of both your own program *and* the that of the shell that called it -- without at the same time corrupting DOS' memory list. As Bob says, rather an advanced topic. I must admit I find it ridiculous that proper facilities for passing data aren't provided. > Another scenario you might consider is using the Dos interprocess > communication area. Any good text on the inner workings of MS-DOS > will contain an explanation. The one I know of is Peter_Norton's_ > Guide_to_the_IBM_PC. This area is about 15 bytes long and, according to Norton, not documented for later DOS releases. I don't know how one is suppoed to use such a miniscule area. Clearly, it can mostly only be used to refer to where the actual data are kept -- but where is that? I suspect it goes almost totally unused. Alastair Milne