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()
This should work:
#include "stdio.h" int main() { system("EXAMPLE=test env|grep EXAMPLE"); }
outputs
EXAMPLE=test