home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / UNLINK.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  2.0 KB  |  66 lines

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