home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / DRRENAME.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  1018 b   |  43 lines

  1. /**
  2. *
  3. * Name        drrename -- Rename a file (on same drive)
  4. *
  5. * Synopsis    ercode = drrename(pold,pnew)
  6. *
  7. *        int  ercode      DOS error code
  8. *        char *pold      Previous filename
  9. *        char *pnew      New filename
  10. *
  11. * Description    This function changes the name of one file to another.
  12. *        Path names may be used, but cannot contain wildcard
  13. *        characters ('*' or '?') or specify different disk
  14. *        drives.  (By using path names, files can be efficiently
  15. *        moved from one directory to another on the same disk
  16. *        drive.)
  17. *
  18. * Returns    ercode          DOS error code
  19. *
  20. * Version    3.0  (C)Copyright Blaise Computing Inc.  1983, 1984, 1986
  21. *
  22. **/
  23.  
  24. #include <bdirect.h>
  25. #include <butility.h>
  26.  
  27. int drrename(pold,pnew)
  28. char *pold,*pnew;
  29. {
  30.     DOSREG dos_reg;
  31.     ADS    name_ads;
  32.  
  33.     dos_reg.ax = 0x5600;
  34.     utabsptr(pold,&name_ads);
  35.     dos_reg.ds = name_ads.s;
  36.     dos_reg.dx = name_ads.r;
  37.     utabsptr(pnew,&name_ads);
  38.     dos_reg.es = name_ads.s;
  39.     dos_reg.di = name_ads.r;
  40.  
  41.     return(dos(&dos_reg));
  42. }
  43.