Operating System - HP-UX
1834828 Members
2329 Online
110070 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...