c++ - How to set environment variable using setenv -
i trying set env variables using setenv function. unfortunately doesn't work expected.
int setnewenvvariable(const std::string *varname, const std::string *value) { setenv(varname->c_str(), value->c_str(), true); return this->var_added; }
it seems work when wants. can change (replace) variable, doesn't changes. cannot add new variable @ all. have tried use putenv. didn't
i have found when doesn't change existed variable. when try add new variable nonexistent yet. after doesn't add new variable , in addition doesn't change existed variable ,but before trying add new variable worked.
i mean before trying add new var accepts changing of existent example path, after passing nonexistent variable path2323 , stops accept changing existed vars.
edit
i have checked return value 0 , errno 0........ wrong ?
Comments
Post a Comment