home *** CD-ROM | disk | FTP | other *** search
/ Internet Standards / CD1.mdf / winsock / errno.c next >
C/C++ Source or Header  |  1993-02-17  |  916b  |  22 lines

  1. #include <winsock.h>
  2.  
  3. /* Copies string corresponding to the error code provided    */
  4. /* into buf, maximum length len. Returns length actually     */
  5. /* copied to buffer, or zero if error code is unknown.       */
  6. /* String resources should be present for each error code    */
  7. /* using the value of the code as the string ID (except for  */
  8. /* error = 0, which is mapped to WSABASEERR to keep it with  */
  9. /* the others). The DLL is free to use any string IDs that   */
  10. /* are less than WSABASEERR for its own use. The LibMain     */
  11. /* procedure of the DLL is presumed to have saved its        */
  12. /* HINSTANCE in the global variable hInst.                   */
  13.  
  14. int PASCAL FAR WSAsperror (int errorcode, char far * buf, int len)
  15. {
  16.         if (errorcode == 0)
  17.                 errorcode = WSABASEERR;
  18.         if (errorcode < WSABASEERR)
  19.                 return 0;
  20.         return LoadString(hInst,errorcode,buf,len);
  21. }
  22.