Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: OT: Passing a Unix environment variable to a 'C' program

Author: Ulrich Tuerke

Date: 09:35:04 05/03/04

Go up one level in this thread


On May 03, 2004 at 12:32:59, ArturoDiDonna wrote:

>Dear all,
>sorry for being OT, but I recently came across the following problem.
>I need to pass the content of the Unix environment variable 'pwd' to a 'C'
>variable and I was wondering if there was any way to perform this job. Ideally,
>I would like to be this code platform-independent code, if possible.
>
>I was wondering if there was any kind soul willing to help me.
>
>Thanks in advance.
>
>Arturo

IIRC, "getenv" does the job
Uli



GETENV(3)                  Linux Programmerâs Manual                 GETENV(3)

NAME
       getenv â get an environment variable

SYNOPSIS
       #include <stdlib.h>

       char *getenv(const char *name);

DESCRIPTION
       The  getenv()  function searches the environment list for a string that
       matches the string pointed to by name.  The strings  are  of  the  form
       name = value.

RETURN VALUE
       The  getenv()  function  returns a pointer to the value in the environâ
       ment, or NULL if there is no match.

CONFORMING TO
       SVID 3, POSIX, BSD 4.3, ISO 9899





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.