Question: How to get the value of an environment variable ?

Hi everybody,

 

I'm working under Windows 7 

 

My need :
A MAPLE code has to be run from an ECLIPSE session (through a cmaple MyCode).
In this ECLIPSE session the user chooses a data file among many, and ECLIPSE then has to tell MyCode what file it has to read.


The solution I figured out :
Step 1 : ECLIPSE  set an environment variable "DataFile" which contains the user's choice, for instance set MyData=NameOfTheFile
Step 2 : Within MyCode I get the value of MyData from these two commands

MyFile := getenv(DataFile):

readdata(MyFile, …)

 

This doesn't work ( getenv(DataFile) returns [1," "] instead of the desired file name).
In fact it seems that getenv enables access to the “native” environment variables of Windows only (for instance HOMEDIR), not to the user defined environment variables (?)


Is  it possible to fix this and how ?

PS  : I face the same difficulties if I type set MyData=NameOfTheFile directly from a cmd command and try to access the value of MyData from a Maple session


Thanks for your help

 

 

Please Wait...