LabWindows/CVI

取消
显示结果 
搜索替代 
您的意思是: 

_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 项奖励
1 条消息(共 3 条)
3,668 次查看

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 项奖励
2 条消息(共 3 条)
3,664 次查看
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 高兴表情 ).


--
Once the game is over, the king and the pawn go back into the same box.
0 项奖励
3 条消息(共 3 条)
3,660 次查看