in reply to setting enviornment variables for parent process

The system call actually forks a child process, runs exec on the process, waits for the process to exit, then returns.

So what you're doing is spawning a new process and setting an environment variable in that process. Then the process exits, the environment variable is lost, and you're left scratching your head. (Just thought you might like to know why system wasn't appropriate here. :)

  • Comment on Re: setting enviornment variables for parent process