TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: WILLIAM MCBRINE
from: BOB STOUT
date: 1998-02-04 17:27:00
subject: Enviorment variables

On , William Mcbrine (1:109/570@fidonet) wrote: 
 JK> Can anyone post some sample code on how to read enviorent vars from
 JK> the current enviorment
 > getenv()
  OK so far...
 JK> and if possible how to modify them?
 > setenv(), putenv(), unsetenv()
  No guaranteed portability by any standards!
 JK> The system I am working with is HP-UX 10.20 but would also like the
 JK> code to work with a Linux system.
 > I believe these calls are POSIX, so no problem there.
  Only getenv() is in Posix.1. There is no standard way to set environment 
variables from a C program. Setting an environment block pointer in an exec() 
call and putenv() are the most commonly supported non-standard methods. Note 
that even these will *not* set the parent or master environment, only the 
environment passed to subordinate processes. 
--- QM v1.00
---------------
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.