I have made some code to change the path environment variable, but it doesn't seem to be working. Somehow. I know that there are current user and system env vars, but I don't know which I am setting. I change it, all functions are successful, but when it is done, I can not access the things in the path in the command prompt.
Definitely um, yeah, doesn't work. Confusing.Code:std::vector<TCHAR> v; int ret = 0; ret = ::GetEnvironmentVariable (TEXT("PATH"), 0, 0); if(ret) { v.resize(ret); } ret = ::GetEnvironmentVariable (TEXT("PATH"), &v[0], v.size()); if(ret) { std::tstring t(&v[0]); t += TEXT(";C:\\Program Files\\MinGWStudio\\MinGW\\bin"); std::tcout << t; ret = ::SetEnvironmentVariable(TEXT("PATH"), t.c_str()); }



LinkBack URL
About LinkBacks



