All pastes #334824 Raw Edit

Anonymous

public cpp v1 · immutable
#334824 ·published 2007-01-31 22:13 UTC
rendered paste body
    #include <iostream>    #include <winsock.h>    /* Don't forget to add the ws2_32.a library!     * @author: AresXP */    int main(int argc, char *argv[])    {      using namespace std;      WSAData wData;          if (WSAStartup(MAKEWORD(2,2), &wData) == SOCKET_ERROR)      {        cout << "Winsock init error\n";        return 1;      }      hostent *h = NULL;      h = gethostbyname(argv[1]);          if (h == NULL)      {        cout << "Could not resolve" << endl;        return 1;      }          cout << inet_ntoa(*(reinterpret_cast<in_addr*>(h->h_addr))) << endl;      return 0;    }