I\'m writing a C program on Linux and need to execute a command with system(), and need to set an environment variable when executing that command, but I don\'t
system()
Use setenv() api for setting environment variables in Linux
setenv()
#include int setenv(const char *envname, const char *envval, int overwrite);
Refer to http://www.manpagez.com/man/3/setenv/ for more information.
After setting environment variables using setenv() use system() to execute any command.