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

  1. /*---------------------------------------------------------------------------
  2.  * filename - chdir.cas
  3.  *
  4.  * function(s)
  5.  *        chdir   - changes working 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            chdir - changes working directory
  25.  
  26. Usage           int chdir(const char *path);
  27.  
  28. Prototype in    dir.h
  29.  
  30. Description     causes the directory specified by path to become the
  31.                 current working directory.
  32.  
  33. Return value    success : 0
  34.                 failure : -1 and errno is set to ENOENT (Path or file
  35.                 name not found)
  36.  
  37. *---------------------------------------------------------------------------*/
  38. int _CType chdir(const char *pathP)
  39. {
  40.         pushDS_
  41. asm     mov     ah, 03Bh
  42. asm     LDS_    dx, pathP
  43. asm     int     021H
  44.         popDS_
  45. asm     jc      chdirFailed
  46.  
  47.         return(0);
  48.  
  49. chdirFailed:
  50.         return __IOerror(_AX);
  51. }
  52.