WinSock Defined Function Error
Im having an error when returning an integer variable to a defined function that seems to be specified to return void. This is in the winsock.h header file for version 1.1. This problem lies in the function WSAGetLastError - which simply stores -1 in int nret. But, WSAGetLastError seems to return void in the included header file.
Code:
int nret;
//...
if(nret == SOCKET_ERROR) {
nret = WSAGetLastError;
ReportError = WSAGetLastError(nret, "bind()");
WSACleanup();
return NETWORK_ERROR; }
//In winsock.h
int PASCAL WSAGetLastError(void);
Should I just edit the header file so that WSAGetLastError returns int? I.E. WSAGetLastError(int) instead of (void)?
Re: WinSock Defined Function Error
Quote:
Originally posted by CPP-Null
Should I just edit the header file so that WSAGetLastError returns int? I.E. WSAGetLastError(int) instead of (void)?
Certainly not.
Your code is wrong.Call WSAGetLastError with no parameters and then you get an integer (error status)
Code:
nret = WSAGetLastError();