Mail Archives: djgpp/1997/06/25/12:04:06

Message-Id: <>
Mime-Version: 1.0
Date: Wed, 25 Jun 1997 13:01:47 -0300
To: fighteer AT cs DOT com, djgpp AT delorie DOT com
From: Cesar Scarpini Rabak <csrabak AT dce03 DOT ipt DOT br>
Subject: Re: How to read/modify environment variables?

At 19:44 24/06/97 +0000, John M. Aldrich wrote:
>Martin Bernreuther wrote:
>> I like to write a small tool to add a path to the PATH variable
>> only if it's not already in.
>> How can I get a hold of the environment variables?
>> Is there already a tool to do this?
>> Is there maybe a tool just to search a environment variable for
>> a string?
>getenv().  Look it up in the libc docs.  See also its complement,

Humm...John, I'm affraid that won't cut in the Martin's desires!

Putenv will only change the environment of the program and its children but
not the main environment, so is if you add a path to the path variable,
after your program return you loose your modification.

AFAIK, messing _permanently_ in the environment requres hacking into DOS.
Cesar Scarpini Rabak                      E-mail: csrabak AT ipt DOT br
DME/ASC                                   Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax:   55-11-268-5996
Av. Prof. Almeida Prado, 532.  Sao Paulo - SP 05508-901 BRAZIL

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019