gethostname: how to obtain my IP

Hello,
I have the following problem with TCP toolkit/runtime 4.24 (and 4.25)
on QNX 4 - I am trying to find out my own IP address in a program:

---- cut ----
if( ( j = gethostname( hostname, 256 ) ) == -1 ) {
return -1;
}
if( ( host = ( struct hostent * ) gethostbyname( hostname ) ) == NULL )
return -1;
---- end cut —

However, the function gethostname tries to open file /etc/uucpname
(as I found using debugger) and if the file is missing, returns -1.
If the file exists and contains an IP or symbolic name corresponding to
the one in /etc/hosts, everything works.

My question is: how to obtain my IP without reading /etc/uucpname file ?

I am sure it is possible - an ftp client from the same runtime
(which must get the IP, since it issues ftp PORT command)
works without /etc/uucpname.

Thanks for answer.


Mgr. Martin Gazak, MicroStep-MIS
Ilkovicova 3, 841 04 Bratislava, Slovakia
Tel: +421 2 60291 816
e-mail:matog@microstep-mis.sk