Operating System - HP-UX
1834704 Members
2882 Online
110069 Solutions
New Discussion

Re: 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...