problem while setting putenv

Hi, I m trying to change the env variable from the c program which inturn calls another c executable. i m using the putenv function but it does not set the value as required , it overwrites the values with some other values...

i m using following cmd's to set the env variable FULL_PATH :

sprintf(file_path,"FULL_PATH=%s",new_file_full_path);
status = putenv(file_path);

How are you executing the child program? fork/exec, system?

Is the environment only corrupted in the current process or the child processes?

The exec family of functions allow you to pass all the environment variables explicitly.

child program is executing using system() command. but the env variables gets corrupted in the current process itself.

what happens if you do

putenv("VARIABLE=value");
system("echo $VARIABLE");
putenv("VARIABLE=value");
system("set");