ENV settings

Dave Hammond daveh at marob.MASA.COM
Thu Dec 15 15:12:50 AEST 1988


In article <10447 at swan.ulowell.edu> tclark at hawk.ulowell.edu writes:
>
>	I'm writing a C program in which I would like to
>	use some of the settings in the user's ENVIRONMENT
>	(i.e. PRINTER, LOGNAME, etc...).
>
>	Could someone tell me how to read these into a string?

The getenv() function returns the string value of an environ parameter, e.g.:

char *getenv(), *p;
if ((p = getenv("LOGNAME")))
	printf("Your LOGNAME is %s\n", p);

--
Dave Hammond
...!uunet!masa.com!{marob,dsix2}!daveh



More information about the Comp.unix.questions mailing list