Hi,

I'm hoping that somebody might be able to help me with a hopefully simple
programming query.

I am in the process of writing a bit of code in C that looks at the parallel
port and sets an environment variable depending on the state of the pins. I
need this to be accessible to a bash script which performs some other
functions.
So far I have the interfacing to the port working fine, but I cannot set the
environment variable.

I have used getenv() to READ an environment variable, and this works fine.
I am trying to use putenv() to set a variable called PINSTAT, but when I
check it is still set to a null value. One thought was that the variable
only remains set whilst the program is running, so I set a do/while loop to
continually set it.  Even with my program in a loop, from another session,
an
"echo $PINSTAT" still shows a null.

I have read a few bits and pieces about glibc's putenv() function not
working correctly - is this my problem and is there a way around it?

Setup is Redhat Linux 6.2, gcc and glibc-2.1.3-23 if this helps.

Thanks in advance,

Geoff




-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to