O
os2
hi
i would like to try to reduce global variable for a program...
i get a value from getenv... after this value will never change... i
tried this code:
void readRtuConfig(char *local_dir_led)
{
if(!(local_dir_led = getenv("LOCAL_DIR_LED")))
{
printf("Incapable de lire la variable: LOCAL_DIR_LED\n");
return 1;
}
printf("%s\n", local_dir_led);
}
void main()
{
char *local_dir_led=NULL;
readRtuConfig(local_dir_led);
printf("%s\n", local_dir_led);
}
the program crash...
maybe that happen because local_dir_led value don't exit outside
readRtuConfig... and try to prinf a value who have nothing?
any idea to resolve that?
thanks
i would like to try to reduce global variable for a program...
i get a value from getenv... after this value will never change... i
tried this code:
void readRtuConfig(char *local_dir_led)
{
if(!(local_dir_led = getenv("LOCAL_DIR_LED")))
{
printf("Incapable de lire la variable: LOCAL_DIR_LED\n");
return 1;
}
printf("%s\n", local_dir_led);
}
void main()
{
char *local_dir_led=NULL;
readRtuConfig(local_dir_led);
printf("%s\n", local_dir_led);
}
the program crash...
maybe that happen because local_dir_led value don't exit outside
readRtuConfig... and try to prinf a value who have nothing?
any idea to resolve that?
thanks