CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Arrow how to convert a URL into an IP address in c++?

    thank you guys

  2. #2
    Join Date
    May 2005

    Re: how to convert a URL into an IP address in c++?

    	WORD wVersionRequested;
    	WSADATA wsaData;
    	int err;
     	wVersionRequested = MAKEWORD( 2, 2 );
    	err = WSAStartup( wVersionRequested, &wsaData );
    	char    Hostname[100];
    	HOSTENT *pHostEnt;
    	int  **ppaddr;
    	SOCKADDR_IN sockAddr;
    	CString addr;
    	pHostEnt = gethostbyname( "www.codeguru.com");
    	ppaddr = (int**)pHostEnt->h_addr_list;
    	sockAddr.sin_addr.s_addr = **ppaddr;
    	addr = inet_ntoa(sockAddr.sin_addr);  //this is your ip address
    if i helped dont forget to rate :-)

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.