Hello,
I was creating a basic winsock application when strange error message appeared ( while initializing winsock ) .. here's the code:
Code:
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <stdio.h>
#pragma comment(lib, "Ws2_32.lib")
int main(void)
{
WSADATA wsadata;
int iresult = WSAStartup(MAKEWORD(2, 2), &wsadata);
if(iresult != 0) printf("WSASTARTUP faild: %d\n", iresult);
else printf("WSAStartup() Call succeeded\n");
if(LOBYTE(wsadata.wVersion != 2) || HIBYTE(wsadata.wVersion != 2))
{
printf("Couldn't find the winsock.dll file!!!\n");
WSACleanup();
}
else printf("Found the required winsock.dll file\n");
WSACleanup();
return 0;
}
And here's the output:
Code:
WSAStartup() Call succeeded
Couldn't find the winsock.dll file!!!
so I added the line:
Code:
printf("low byte: %d, High byte: %d\n", LOBYTE(wsadata.wVersion), HIBYTE(wsadata.wVersion));
in the second if clause
and found the strange output:
Code:
WSAStartup() Call succeeded
Couldn't find the winsock.dll file!!!
low byte: 2, High byte: 2
so what?
Am I missing something?
thanks in advance ..
Note:
OS Name: Microsoft Windows 7 Home Premium
OS Version: 6.1.7600 N/A Build 7600