Programming and posix - April 2002

April 3, 2002
Solution Symposium
Page 32
hp e3000
programming
and posix
environment variables - writing
#include <stdlib.h>
#include <stdio.h>
int main() {
if (putenv("BAR=456")) {
printf("putenv failed"); exit(2);
}
system("echo $BAR"); /* executes in a child shell */
}