Hi Experts I am trying to print a error string using FormatMessage(), ive been at this for a while now, and cant seem to solve it. it prints the error code, but not the string, instead it ouputs "N"? if you can help with this i will be very grateful.. Code: void handle_error(const char *msg) { LPVOID lpMsgBuf; int e; lpMsgBuf = (LPVOID)"Unknown error"; e = WSAGetLastError(); if (FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, e, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR)&lpMsgBuf, 0, NULL)) { fprintf(stderr, "%s: Error %d: %s\n", msg, e, lpMsgBuf); LocalFree(lpMsgBuf); } else fprintf(stderr, "%s: Error %d\n", msg, e); } Output: Code: Log: Failed to connect!: Error 10061: N