home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 1.ddi / CLIBSRC1.ZIP / UNLINK.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.8 KB  |  65 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - unlink.cas
  3.  *
  4.  * function(s)
  5.  *        unlink - deletes a file
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <dos.h>
  20. #include <_io.h>
  21.  
  22. /*-----------------------------------------------------------------------*
  23.  
  24. Name            unlink - deletes a file
  25.  
  26. Usage           int unlink(const char *filename);
  27.  
  28. Related
  29. functions usage int remove(const char *filename);
  30.  
  31. Prototype in    dos.h
  32.  
  33. Description     unlink deletes a file specified by filename. Any
  34.                 MS-DOS drive, path, and file name may be used as a filename.
  35.                 Wildcards are not allowed.
  36.  
  37.                 Read-only files cannot be deleted by this call. To remove
  38.                 read-only files, first use chmod or _chmod to change the
  39.                 read-only attribute.
  40.  
  41.                 remove is a macro that simply translates the call to a call
  42.                 to unlink.
  43.  
  44. Return value    On successful completion, a 0 is returned. On
  45.                 error, a -1 is returned, and errno is set to one of the
  46.                 following values:
  47.  
  48.                         ENOENT  Path or file name not found
  49.                         EACCES  Permission denied
  50.  
  51. *------------------------------------------------------------------------*/
  52. int _CType unlink(const char *filename)
  53. {
  54.         pushDS_
  55. asm     mov     ah, 041h
  56. asm     LDS_    dx, filename
  57. asm     int     021H
  58.         popDS_
  59. asm     jc      unlinkFailed
  60.     return(0);
  61.  
  62. unlinkFailed:
  63.     return __IOerror(_AX);
  64. }
  65.