Skip to content

Instantly share code, notes, and snippets.

@pamaury
Created December 8, 2020 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pamaury/8d0d9f4aa748668524571f21ad07dffd to your computer and use it in GitHub Desktop.
Save pamaury/8d0d9f4aa748668524571f21ad07dffd to your computer and use it in GitHub Desktop.
void myperror(const char *msg) {
char *wsa_message = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
WSAGetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR)&wsa_message,
0,
NULL);
printf("%s : %s\n", msg, wsa_message);
LocalFree(wsa_message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment