Winsock error - message lib\header?

Started by
2 comments, last by hplus0603 18 years, 8 months ago
Hiya, I'm looking for a simple way to convert Winsock "WSAGetLastError()" messages to strings. Does anyone know of a C/C++ header or function that can be used to do this (either a Windows header or a 3rd party one)? Thanks. Just to verify, I need something like:
  char * ErrorMessage(int error_code);
or even:
  char * error_array[] = {...
Cheers! Edit: can anyone tell me why my rating dropped 50+ points after disagreeing with an "elite" member (whos opinion is obviously worth more than mine)? Is that not allowed here?
Advertisement
You can simply use FormatMessage:

char buffer [1024];int bufsize = sizeof (buffer);FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, 0, buffer, bufsize, NULL);


As for your rating. It can drop for no apparent reason whatsoever. Perhaps you were disrespectful or rude, perhaps extremely obtuse. Maybe the person rating you was just having a bad day. I've seen my rating drop with some of what I considered my most helpful posts.
Kippesoep
Perfect [grin] Thanks a lot.

Quote:As for your rating. It can drop for no apparent reason whatsoever. Perhaps you were disrespectful or rude, perhaps extremely obtuse. Maybe the person rating you was just having a bad day. I've seen my rating drop with some of what I considered my most helpful posts.

I see :/ I probably came off as being pretty rude. It's just annoying when you're trying to help and someone comes along and tells you that how you choose to do things is 'wrong'.
Please don't post about ratings in this forum; it's highly off-topic. I suggest the lounge -- or just live with it as it is; your contributions over time are likely to speak much louder than any random variations in rating.
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement