Move a file

From CometWiki

Jump to: navigation, search

DOS pseudo functions: Move a file

Syntax:

 DOSMS(AX-value, BX-value, Source file name, Target file name) EXCP=statement-label  

Entry:

 All arguments are strings. 
 AX = "@FFF9@"
 BX = not used

Discussion:
This pseudo function moves a file from one directory to another.
If the target directory is on the same logical drive as the source directory, the file is renamed.
Otherwise, the file is copied to the target drive, after which the source file is erased.
It is essential to append Hex 00, "@00@" to the end of each file name.

Here is a sample code fragment:

Length 2 & Local AX$  BX$
Length 3 & Local DosCode$
Length 128 & Local SourceFileName$  TargetFileName$
!
Print (0) (ET)
!
Print (0) "Enter From File"
Input (0) SourceFileName$
!
SourceFileName$ = SourceFileName$ + "@00@"
!
Print (0) "Enter To File"
Input (0) TargetFileName$
!
TargetFileName$ = TargetFileName$ + "@00@"
!
AX$ = "@FFF9@"  & BX$ = "@0000@"
!
DOSMS(AX$,BX$,SourceFileName$,TargetFileName$) EXCP=OOPS
!
!
OOPS:
       Close(49) & Open (49) "QERCOMET"
       Doscode$ = "D" + HEXASC(SUB(AX$,2,1)
       Read (49) Mess$
       Print (0) @(0,23) Doscode$ + "  " + Mess$
       Input(0) ""





DOS pseudo functions

Personal tools