home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l440 / 2.ddi / CHAP6 / SWITCHAR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-26  |  696 b   |  34 lines

  1. /*
  2. SWITCHAR.C -- uses undocumented DOS Function 3701h
  3. switchar    changes DOS switch char to - and path char to /
  4. switchar \  restores DOS switch char to / and path char to \
  5. */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <dos.h>
  10.  
  11. main(int argc, char *argv[])
  12. {
  13.     int c = (argc > 1) ? argv[1][0] : '-';
  14. #ifdef __TURBOC__
  15.     _DL = c;
  16.     _AX = 0x3701;
  17.     geninterrupt(0x21);
  18.     _AH = 0;            // retval in AX
  19. #elif defined(_MSC_VER) && (_MSC_VER >= 600)
  20.     _asm {
  21.         mov dl, c
  22.         mov ax, 3701h
  23.         int 21h
  24.         xor ah, ah        ; retval in AX
  25.         }
  26. #else
  27.     union REGS r;
  28.     r.h.dl = c;
  29.     r.x.ax = 0x3701;
  30.     intdosx(&r, &r);
  31.     return r.h.al;
  32. #endif
  33. }
  34.