Operating System - HP-UX
1835346 Members
3113 Online
110078 Solutions
New Discussion

Is there an unix system call for get the host name?

 
SOLVED
Go to solution
Ai Jun Zhang
Occasional Contributor

Is there an unix system call for get the host name?

Hi!

I am using C, and I would like to get the host name in my C code. Is there an unix system call for retrieving the host name?

Thanks.
Aijun.
2 REPLIES 2
Vladislav Demidov
Honored Contributor
Solution

Re: Is there an unix system call for get the host name?

see man gethostname for reference.
#include

int gethostname(char *hostname, size_t size);
James R. Ferguson
Acclaimed Contributor

Re: Is there an unix system call for get the host name?

Hi:

Yes, gethostname()

...JRF...