Thread: how to get the DNS hostname?

  1. #1
    Registered User
    Join Date
    Nov 2006

    how to get the DNS hostname?

    when i type "hostname" in the command line I get something like
    I wonder if there is a function that returns that value...
    (I have tried with gethostname() but it only returns me 2.x.a , which is incomplete)
    Mac OS 10.6 Snow Leopard : Darwin

  2. #2
    Registered User
    Join Date
    Oct 2006
    well, assuming your program is going to be UNIX-only, check the man page for hostname. you will see in the explanation that all it does, pretty much, is read from a file and prints it. what you can do is read from that same file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How do I get the Hostname in Java?
    By cpjust in forum Tech Board
    Replies: 9
    Last Post: 02-07-2009, 12:13 PM
  2. DNS issue
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 08-02-2008, 10:15 AM
  3. DNS & Mail settings modifier
    By DemonSoul in forum A Brief History of
    Replies: 1
    Last Post: 05-20-2004, 12:43 PM
  4. Resolving Hostname :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 04-08-2002, 08:26 AM