C (156/301)

From:Jarno van der Linden
Date:13 Aug 99 at 22:03:13
Subject:Re: Re: ENV and ENVARC

From: Jarno van der Linden <jarno@kcbbs.gen.nz>

Note that there is OS support for loading and saving environment vars:

dos.library/GetVar()
NAME
GetVar -- Returns the value of a local or global variable (V36)
SYNOPSIS
len = GetVar( name, buffer, size, flags )
D0 D1 D2 D3 D4
LONG GetVar( STRPTR, STRPTR, LONG, ULONG )

dos.library/SetVar()
NAME
SetVar -- Sets a local or environment variable (V36)
SYNOPSIS
success = SetVar( name, buffer, size, flags )
D0 D1 D2 D3 D4
BOOL SetVar(STRPTR, STRPTR, LONG, ULONG )

One of the flags for SetVar is (from dos/var.h):

/* this is only supported in >= V39 dos. V37 dos ignores this. */
/* this causes SetVar to affect ENVARC: as well as ENV:. */
#define GVB_SAVE_VAR 12 /* only with GVF_GLOBAL_VAR */
#define GVF_SAVE_VAR 0x1000

Please use those functions instead of writing your own variable saving
routines.

---JvdL---