Setting Environment variable..!

Hi,

I already have one CPP program which invokes the C program.And the C program contains whole function definitions..!This is a working program..I have to enable the logs in both CPP as well as in the C program ..!So I am reading the enviornmental variable log path from the CPP and doing the logging in CPP program..But I have to use the logging in the C program also...So again should I read the enviornmental variable for log path?As of now I am reading it in the C program also..But I dnt think it will work..I cant pass the file pointer as an argument because I dont have permission to change these functions..!I am using the gcc compiler only..!

Can anybody help me out on this..?

Example code:
test1.cpp
---------

#include "test.h"
 
int main()
{
     char * descr = getenv("LOG_PATH");
     FILE *pFile = fopen(descr,"a");
     char *name;
     printf("Variable is defined %s",descr);
     printf("Enter the name : ");
     scanf("%s" ,name);
     fprintf(pFile, "name is %s: ",name);
     display(name);
}
 
test_fun.c
-----------
//this file contains only the function definitions..
char *descr=getenv("LOG_PATH"); 
FILE *pFile=fopen(descr,"a");
 
void display(char name)
{
   fprintf(pFile,"~~~~~~name is %s~~~~~~~",name);
}

 
test.h
------
void display(char *name);

This is an example code only..!

Thanks in advance....!!!

Why will reading in a an environment variable and opening a file "a" (append) not work?
The file pointer will be at the end of the file?

Instead of explaining what you think should be done, please tell us your requirements.
There is some kind of misunderstanding about how file descriptors work going on here.

Hi,
I have to enable the logs in the application. And the log file should be read from the environment variable. The cpp and the c program (which includes all function definitions) also should contain the logs.

this is my requirement....Can anybody help me out...?

Thanks in advance..!!!