getenv() fails

Miguel Cardenas mfcardenas at prodigy.net.mx
Mon Jul 12 23:28:11 PDT 2004


Hello...

I have a problem getting the hostname from the HOSTNAME var...

#include <stdlib.h>
...
char* host = getenv("HOSTNAME");

returns always NULL... why? if I do 'echo $HOSTNAME' it is visible, but inside 
my C program returns NULL... what is wrong? is it a bug?

Thanx...



More information about the freebsd-questions mailing list