E
Ehsan
I wrote this simple code for setting environmental variable in linux
but it's seems deosn' work.
/************************************************************************/
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char * argv[]){
int i=0;
if (argc!=3){
printf("wrong command line\n");
return 1;
}
else {
i=setenv(argv[1],argv[2],1);
if (i==0)
printf("%s is set to %s \n",argv[1],argv[2]);
else if (i==-1)
printf("no enough memory");
return i;
}
}
/***************************************************************************/
it was compiled succesfully but nothing's changed after execution of
this program. I type "env" in shell but my variables weren't added to
env list!!!!!!
thanx for oyur probable help
but it's seems deosn' work.
/************************************************************************/
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char * argv[]){
int i=0;
if (argc!=3){
printf("wrong command line\n");
return 1;
}
else {
i=setenv(argv[1],argv[2],1);
if (i==0)
printf("%s is set to %s \n",argv[1],argv[2]);
else if (i==-1)
printf("no enough memory");
return i;
}
}
/***************************************************************************/
it was compiled succesfully but nothing's changed after execution of
this program. I type "env" in shell but my variables weren't added to
env list!!!!!!
thanx for oyur probable help