CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    1,029

    how to convert hostent member h_addr to a string?

    Hello,

    I have a hostent h_addr and I want to convert that to a string IP address. How can I do that?

    I tried this:

    Code:
    string ipaddress;
    struct hostent *h;
    h = gethostbyname(hostname.c_str());
    ipaddress=h->h_addr;
    but that doesnt work..

    Thanks!

  2. #2
    Join Date
    May 2001
    Location
    Germany
    Posts
    1,158

    Re: how to convert hostent member h_addr to a string?

    lookup inet_ntoa or inet_ntop

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured