home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / prgmming / clipper / gt_ernam.prg < prev    next >
Text File  |  1993-10-14  |  4KB  |  114 lines

  1. /*
  2.  File......: GT_ERNAM.prg
  3.  Author....: Phillip Hamlyn
  4.  BBS.......: The Dark Knight Returns
  5.  Net/Node..: 050/069
  6.  User Name.: Phillip Hamlyn
  7.  Date......: 03/03/93
  8.  Revision..: 1.0
  9.  
  10.  This is an original work by Phillip Hamlyn and is placed in the
  11.  public domain.
  12.  
  13.  Modification history:
  14.  ---------------------
  15.  
  16.  Rev 1.0 03/03/93
  17.  Initial revision.
  18. */
  19.  
  20. /*  $DOC$
  21.  *  $FUNCNAME$
  22.  *      GT_ERNAM()
  23.  *  $CATEGORY$
  24.  *      File I/O
  25.  *  $ONELINER$
  26.  *      Show a DOS error message
  27.  *  $SYNTAX$
  28.  *      GT_ErNam( <nError> ) --> <cErrorMess>
  29.  *  $ARGUMENTS$
  30.  *      <nError>      A valid DOS error number. Could be the value
  31.  *                    returned by FERROR()
  32.  *  $RETURNS$
  33.  *      <cErrorMess>  The description of the error message.
  34.  *                    Default "".
  35.  *  $DESCRIPTION$
  36.  *      Function used to return a text description of a DOS error number up
  37.  *      to dos error number 88.
  38.  *  $EXAMPLES$
  39.  *      local nErr
  40.  *      Fopen("exist.not")
  41.  *      if ( nErr := ferror() ) > 0
  42.  *          ? GT_ErNam(nErr) --> "File not found"
  43.  *      endif
  44.  *  $SEEALSO$
  45.  *
  46.  *  $INCLUDE$
  47.  *
  48.  *  $END$
  49.  */
  50.  
  51. #include "gt_lib.ch"
  52.  
  53. //================
  54. function GT_ErNam (nError)
  55. //================
  56. /*
  57. returns the name of a DOS error number
  58. */
  59. local cError := "",nPos := 0
  60. static aErrors
  61. if aErrors == NIL
  62.     aErrors := { {0,"No error"},;
  63.         {1,"Invalid function number"},{2,"File not found"},{3,"Path not found"},;
  64.         {4,"Too many open files"},{5,"Access denied"},{6,"Invalid handle"},;
  65.         {7,"MCB's destroyed"},{8,"Insufficient memory"},{9,"Invalid memory address"},;
  66.         {10,"Invalid environment"},{11,"Invalid format"},{12,"Invalid access code"},;
  67.         {13,"Invalid data"},{14,"Reserved Error"},{15,"Invalid drive"},;
  68.         {16,"Removal of current directory"},{17,"Not same device"},{18,"No more files"},;
  69.         {19,"Write protected"},{20,"Unknown unit"},{21,"Drive not ready"},;
  70.         {22,"Unknown command"},{23,"CRC Error"},{24,"Bad request structure length"},;
  71.         {25,"Seek error"},{26,"Unknown media type"},{27,"Sector not found"},;
  72.         {28,"Printer out of paper"},{29,"Write Fault"},{30,"Read fault"},;
  73.         {31,"General failure"},{32,"Sharing violation"},;
  74.         {33,"Lock violation"},{34,"Invalid disk change"},{35,"FCB unavailable"},;
  75.         {36,"Sharing buffer overflow"},{37,"Reserved"},{38,"Reserved"},{39,"Reserved"},;
  76.         {40,"Reserved"},{41,"Reserved"},{42,"Reserved"}, {43,"Reserved"}, {44,"Reserved"},;
  77.         {45,"Reserved"},{46,"Reserved"},{47,"Reserved"},{48,"Reserved"},{49,"Reserved"},;
  78.         {50,"Network request not supported"},{51,"Remote computer not listening"},;
  79.         {52,"Duplicate name on network"},{53,"Network name not found"},;
  80.         {54,"Network busy"},{55,"Network device no longer exists"},;
  81.         {56,"Network BIOS limit exceeded"},{57,"Network hardware adapter error"},;
  82.         {58,"Incorrect response from network"},{59,"Unexpected network error"},;
  83.         {60,"Incompatible remote adapter"},{61,"Print queue full"},;
  84.         {62,"Not enough space for print files"},{63,"Print file deleted"},;
  85.         {64,"Network name deleted"},{65,"Access denied"},;
  86.         {66,"Network device type incorrect"},{67,"Network name not found"},;
  87.         {68,"Network name limit exceeded"},{69,"Network BIOS session exceeded"},;
  88.         {70,"Temporarily paused"},{71,"Network request not accepted"},;
  89.         {72,"Print or disk redirection paused"},{73,"Reserved"},;
  90.         {74,"Reserved"},;
  91.         {75,"Reserved"},;
  92.         {76,"Reserved"},;
  93.         {77,"Reserved"},;
  94.         {78,"Reserved"},;
  95.         {79,"Reserved"},;
  96.         {80,"File already exists"},;
  97.         {81,"Reserved"},;
  98.         {82,"Cannot make directory entry"},;
  99.         {83,"Fail on INT24H"},;
  100.         {84,"Too many redirections"},;
  101.         {85,"Duplicate redirection"},;
  102.         {86,"Invalid password"},;
  103.         {87,"Invalid parameter"},;
  104.         {88,"Network device fault"} }
  105.     // and thats all I'm prepared to type !
  106. endif
  107.  
  108. if (nPos := ascan(aErrors,{| aSingle | aSingle[1] == nError } ) ) > 0
  109.     cError := aErrors[nPos][2]
  110. else
  111.     cError := ""
  112. endif
  113. return cError
  114.