Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > WSAGetLastError() question
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 23rd May 19:34
charles wilkins <2boxers_at_comcast.net>
External User
 
Posts: 1
Default WSAGetLastError() question



How does one go about obtaining the WSAGetLastError Code itself, not
the int value?

For example:
here is the return code: WSAHOST_NOT_FOUND
here is the return value: 11001

as indicated here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/windows_sockets_functions_2.asp

When this condition exists, I know that WSAGetLastError returns 11001,
but what construct or function can I use to get it to return
WSAHOST_NOT_FOUND.

The idea is to make the return code more intuitive. (for the cases
where the codes themselves are somewhat intuitive)

In BSD, I can call strerror(errno) to get the string associated with
errno, or in the case if dealing with certain functions such as
gethostbyname, I can call hstrerror(h_errno) to get a more intuitive
error:

Does such a function exist for windows?

Thanks in advance for any replies.
Charles
  Reply With Quote


  sponsored links


2 23rd May 19:34
manny
External User
 
Posts: 1
Default WSAGetLastError() question



It does return WSAHOST_NOT_FOUND.

"WSAHOST_NOT_FOUND" is a #define'd constant in winsock.h. In C/C++,
WSAHOST_NOT_FOUND is simply a symbol that expands to the value 11001.
Internally, Windows knows nothing of the string "WSAHOST_NOT_FOUND".

I think what you are looking for is the FormatMessage() API call, which will
give you a descriptive string for an error number.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666