[Windows] use WSAGetLastError() in Win32 build
Closed this issue · 0 comments
mchome commented
Use WSAGetLastError
instead of using perror
.
- Linux build
#include <stdio.h>
#include <stdlib.h>
void DieWithError(char *errorMessage) {
perror(errorMessage);
exit(1);
}
- Win32 build
#include <winsock.h>
#include <stdlib.h>
void DieWithError(char *errorMessage) {
fprintf(stderr,"%s: %d\n",
errorMessage, WSAGetLastError());
exit(1);
}