home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 273_01 / chgto.cc < prev    next >
Text File  |  1988-04-11  |  910b  |  27 lines

  1. #include <dir.h>
  2.  
  3. change_to(char *dir)
  4. /*
  5. ┌────────────────────────────────────────────────────────────────────┐
  6. │Purpose: To change the current disk drive and directory with        │
  7. │         one call.                                                  │
  8. │ Inputs: Char *dir points to directory to change to. This may       │
  9. │         contain a drive letter if required.                        │
  10. │Outputs: None.                                                      │
  11. │                                                                    │
  12. │ Return:  0 = successful.                                           │
  13. │         -1 = directory not found.                                  │
  14. └────────────────────────────────────────────────────────────────────┘
  15. */
  16. {
  17. char disk;
  18.  
  19.     if(*(dir + 1) == ':') {
  20.         disk = *dir;
  21.         disk = toupper(disk);
  22.         setdisk(disk - 'A');
  23.     }
  24.  
  25.     return(chdir(dir));
  26. }
  27.