Using of environment variables

Hi all,

In my Photon application I have to read/write files from/to the home
directory of the user. I would like to use the HOME environment variable to
determine that directory. BUT I do not know how to work with environment
variables. Which header files should I include? HOME or $HOME (or neither)
is the correct usage?

Can somebody help me?

Thanks,

Eszter Polczer

Polczer Eszter <sther@mailbox.hu> wrote:
PE > Hi all,

PE > In my Photon application I have to read/write files from/to the home
PE > directory of the user. I would like to use the HOME environment variable to
PE > determine that directory. BUT I do not know how to work with environment
PE > variables. Which header files should I include? HOME or $HOME (or neither)
PE > is the correct usage?

PE > Can somebody help me?

PE > Thanks,

PE > Eszter Polczer

The function you want is getenv(). The header is in stdlib.h. Look
at getenv() in the helpviewer docs.

Basically your call will look like this:
char * home_directory;
home_directory = getenv( “HOME” );


Bill Caroselli – Q-TPS Consulting
1-(708) 308-4956 <== Note: New Number
qtps@earthlink.net