Re: How can i get an env. variable
Posted in 1997
On Wed, 5 Nov 1997, Art S. Kagel wrote: } Christian Hernoux wrote: } > } > I use i4gl ver. 4.11.UC4. How can i get an env. variable ? } > Does exist a fg??? fonction ? } } There is the function fgl_getenv( "ENVVAR" ) but I think that it was } introduced in 4GL 6.0. You can easily write a "C" function that calls } getenv and returns the value to 4GL: } } int fgl_getenv( int argcnt ) } { } char var[256], *val; } } popvchar( var, 256 ); } val = getenv( var ); } } retvchar( val ); } } return 1; } } Art's use of popvchar is better than my use of popquote(). I should have used either popvchar() or popstring() -- though the latter is not part of 4.11 I4GL so popvchar() is the best choice. The code I posted is broken because it blank pads the user-supplied environment variable name. Oops! On the other hand, I did ensure that getenv() was declared as a function returning a 'char *' :-) Yours, Jonathan Leffler (johnl@informix.com) #include <witticism.h>