LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

_putenv() problem

I'm currently trying to set an env variable via _putenv() function, which seems to work inside my cvi-program (env variable set by _putenv() can be successfully read
by getenv() in same program), however,  this variable seems not to be propagated to the calling environmet.
that means, when I call the standalone executable from cmd.exe, the mentioned env variable has not been set when checked with 'set' after program execution.
is this a known behaviour, or am I missing something ?
(still using cvi 7.0, btw.).

--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 1 of 3
(3,560 Views)

That is expected behaviour. When any executable runs, it inherits a copy of the environment to play with; it is within this copy that any changes to environment variables are made by the running program, so these changes cannot propagate to the caller. Maybe you need to investigate using the registry?

JR

0 Kudos
Message 2 of 3
(3,556 Views)
ok, thanks for clarification (sadly, the behaviour is as supposed from my observations).
and yes, I could go for using the registry, probably, which is what I wanted to avoid.
so, I'll probably write/read a temporary file (ugly, but works Smiley Happy ).


--
Once the game is over, the king and the pawn go back into the same box.
0 Kudos
Message 3 of 3
(3,552 Views)