how to convert a URL into an IP address in c++?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

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

  1. #1
    Join Date
    Jan 2005
    Posts
    73

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

    thank you guys

  2. #2
    Join Date
    May 2005
    Posts
    4,954

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

    Code:
    	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 :-)
    Cheers

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center