Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2001 14:04:23 -0400
From:      Nathan Vidican <webmaster@wmptl.com>
To:        questions@freebsd.org
Subject:   OT: accessing environment variables using C/C++
Message-ID:  <3B056427.9090809@wmptl.com>

next in thread | raw e-mail | index | archive | help
Not sure where else to ask, I've tried a myriad of IRC channels, etc to 
no avail. So I figured I'd ask here, seeing as how the broad range of 
people who are on this list will most likely have someone who's done 
this before me.

What I need to know, is how to access an environment variable from C. I 
usually program in PERL, and have a very limited amount of experience 
with C/C++. This will be my first attempt at creating an application. I 
am trying to convert something I wrote in PERL to C.

It's a simple CGI script, which accesses a few server-side environment 
variables. In PERL for example, I can access the value of HTTP_REFERER, 
using the hash of environment variables, and the key HTTP_REFERER; like 
so: $ENV{'HTTP_REFERER'}. However I want to try and do the same from C, 
but that far have been unable to figure out how to call upon environment 
variables.

In short, if anyone could provide me a quick blotch of code, (say a 
declaration, and an assignment), which demonstrates the usage of an 
environment variable it would be much appreciated.

-- 
--
Nathan Vidican
webmaster@wmptl.com
Windsor Match Plate & Tool Ltd.
http://home.wmptl.com/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B056427.9090809>