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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - mkdir.cas
  3.  *
  4.  * function(s)
  5.  *        mkdir - creates a directory
  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 <dir.h>
  20. #include <_io.h>
  21.  
  22. /*-----------------------------------------------------------------------*
  23.  
  24. Name            mkdir - creates a directory
  25.  
  26. Usage           int mkdir(const char *pathname);
  27.  
  28. Related
  29. functions usage int rmdir(const char *pathname);
  30.  
  31. Prototype in    dir.h
  32.  
  33. Description     mkdir takes the given pathname and creates a new
  34.                 directory with that name.
  35.  
  36.                 rmdir deletes the directory given by pathname. The
  37.                 directory named by pathname
  38.  
  39.                         must be empty
  40.  
  41.                         must not be the current working directory
  42.  
  43.                         must not be the root directory
  44.  
  45. Return value    mkdir returns the value 0 if the new directory was
  46.                 created.
  47.  
  48.                 rmdir returns 0 if the directory is successfully deleted.
  49.  
  50.                 With either function, a return value of -1 indicates an error,
  51.                 and errno is set to one of the following values:
  52.  
  53.                         EACCES  Permission denied
  54.                         ENOENT  Path or file name not found
  55.  
  56. *------------------------------------------------------------------------*/
  57. int mkdir(const char *pathP)
  58. {
  59.         pushDS_
  60. asm     mov     ah, 039h
  61. asm     LDS_    dx, pathP
  62. asm     int     021H
  63.         popDS_
  64. asm     jc      mkdirFailed
  65.         return(0);
  66.  
  67. mkdirFailed:
  68.         return __IOerror(_AX);
  69. }
  70.