Sto iniziando a studiare l'utilizzo delle socket in c. La prima applicazione è questa:
codice:
#include <stdio.h>
#include <winsock.h>
int main() {
typedef struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char FAR* lpVendorInfo;
} WSADATA;
// Initialize Winsock
WSADATA wsaData;
WORD wVersionRequested;
wVersionRequested= MAKEWORD(2,2);
int iResult = WSAStartup (wVersionRequested, &wsaData);
if (iResult != 0) {
printf ("Error at WSAStartup()\n");
printf ("A usable WinSock DLL cannot be find");
return 0;
}
// The WinSock DLL is acceptable. Proceed
printf("No errors occurred. \n");
system ("pause");
return 0;
}
// main end
Alla riga int iResult = WSAStartup(wVersionRequested, &wsaData)
Ricevo l'errore:
passing argument 2 of 'WSAStartup' from incompatible pointer type [enabled by default]
Programma copiato interamente da slides uni...dove sta l'errore?