Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the hostname from the system 1

Status
Not open for further replies.

josebravo

Programmer
Jun 29, 2001
7
DE
Hallo my friends, I'm programming in c++ under an UNIX machine and I would like to get the name of the machine and put it in a variable of type char*. How can I do it?

I know I can do: system("hostname") but the return value is an integer and I would want to get the name.

Thanks in advance, I will be very grateful.

Jose.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top