Set environment variables in C

后端 未结 4 951
我在风中等你
我在风中等你 2020-11-28 08:02

Is there a way to set environment variables in Linux using C?

I tried setenv() and putenv(), but they don\'t seem to be working for me.

4条回答
  •  醉话见心
    2020-11-28 08:24

    The environment variable set by setenv()/putenv() will be set for the process that executed these functions and will be inherited by the processes launched by it. However, it will not be broadcasted into the shell that executed your program.

    Why isn't my wrapper around setenv() working?

提交回复
热议问题