Remove DOS Subdirectory
From CometWiki
Remove DOS Subdirectory (RMDIR)
Syntax:
DOSFC(AX-value, CX-value, subdirectory-name) EXCP=statement-label
Entry:
AX-value = "@3A00@" CX-value = "@0000@"
Return:
If an exception occurs, byte 2 of the AX field will contain the D
OS error code (in hex).
Discussion:
The DOSFC function call can be used to remove a DOS subdirectory. This function requires that the AX-value be set to "@3A00@" and the CX-value be set to null. The subdirectory-name parameter must contain the name of the subdirectory to be removed from the disk.
Upon successful execution of this function, the named subdirectory will no longer exist.
Example:
! S SRMDIR,DSK ! O RMDIR,DSK ! L T00,E ! R QMONITOR ! !========== REMOVE DOS SUBDIRECTORY (RMDIR) =================== ! LENGTH 2 & LOCAL AX$,BX$,CX$,DX$ ! Define registers LENGTH 64 & LOCAL DIRECTORY$ ! Define directory name ! LENGTH 3 & LOCAL DOSCODE$ ! Define DOS error code LENGTH 37 & LOCAL DOSMESSAGE$ ! Define DOS message ! 1000 FORMAT DOSMESSAGE$ ! File input format ! 100 FORMAT (ET) ! Screen format ! CLEAR ! Initialize variables PRINT (0,100) ! Set typewriter mode ! PRINT (0) "ENTER DIRECTORY NAME:" ! Display prompt INPUT (0) DIRECTORY$ ! Enter directory name IF DIRECTORY$ = "" THEN RUN "QMONITOR" ! If null, then stop ! AX$ = "@3A00@" ! Set AX to "REMOVE DIR." CX$ = "@0000@" ! Set CX register to null ! DOSFC(AX$,CX$,DIRECTORY$) EXCP=EXCEPTION ! Perform DOSFC call ! PRINT (0) DIRECTORY$;" REMOVED." INPUT (0) "" RUN "QMONITOR" ! EXCEPTION: ! Exception routine PRINT (0) "DIRECTORY NOT REMOVED." ! Display message OPEN (1) "QERCOMET" ! Open error file DOSCODE$ = "D" + HEXASC(SUB(AX$,2,1)) ! Construct key to file READ (1,1000) KEY=DOSCODE$ ! Read error record PRINT (0) "DOS error code: ";DOSCODE$ ! Display DOS error code PRINT (0) DOSMESSAGE$ ! Display error message INPUT (0) "" ! Hold CLOSE (1) ! Close error file RUN "QMONITOR" ! Exit END