My goal is to add a program path to PATH variable so a different part of program can launch it by merely specifying its name, like this
int main()
{
system("export PATH=%PATH%;/home/user/Workspace/myproject/build/bin/mybinary");
system("echo $PATH");// <-- the PATH is changed
//a far place in code
system("mybinary"); // <-- this should run the executable, but it can't find it
return 0;
}
Is this even possible to be done?