Alex Rivera | Logout

Set local environment variables in C++

Asked 2009-05-22T19:12:14.150
62

How do I set an environment variable in C++?

  • They do not need to persist past program execution
  • They only need to be visible in the current process
  • Preference for platform independent but for my problem only needs to work on Win32/64

Thanks

Edit
Report

1 Answer

2

I'm not positive environment variables are what you need, since they aren't going to be used outside of this run of the program. No need to engage the OS.

You might be better off having a singleton class or a namespace that holds all these values, and initialize them when you start the program.

answered 2009-05-22T19:53:00.807

Your Answer