Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 May 2001 14:17:44 -0400
From:      Michael Dungan <vega@res142a-008.rh.rit.edu>
To:        nathan@vidican.com
Cc:        questions@freebsd.org
Subject:   Re: OT: accessing environment variables using C/C++
Message-ID:  <20010518141744.A49140@rit.edu>
In-Reply-To: <3B056427.9090809@wmptl.com>; from webmaster@wmptl.com on Fri, May 18, 2001 at 02:04:23PM -0400
References:  <3B056427.9090809@wmptl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 18, 2001 at 02:04:23PM -0400, Nathan Vidican wrote:
> 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.
Is getenv(3) what you want?

> Nathan Vidican
> webmaster@wmptl.com

mpd
-- 
___________________________________________________________
 
Little Girl: "MAY I GROW 3005 PLANTS??"
Pokey the Penguin: "NO"
	- from "3005 PLANTS"

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?20010518141744.A49140>