GN_Cpy, Copy a file

Register parameters

RST 20H, DEFW $8C09
IN: A   = reason code
          CP_TODIR  = $00, copy file to a directory (keep same filename)
          CP_TOFILE = $01, copy file as new file target
    BHL = pointer to null-terminated source filename (B=0, local)
    CDE = pointer to a null-terminated target directory or filename (C=0, local)
out, if successful:
        Fc = 0, file successfully copied to target
out, if failed:
        Fc = 1, unable to copy file
        A = error code:
             RC_IVF, Invalid directory or filename
                            RC_ONF, File Object was not found
             RC_USE, File in use
             RC_EXIS, File already exists
   registers changed after return:
        A.BCDEHL/IXIY  same
        .F....../....  different


  • API call implemented in OZ 5.0.
  • Specified target directory will automatically be recursively created if not found (CP_TODIR). When copying as new file (CP_TOFILE), the target directory must exist.

Related calls

GN_Cl, close file 
GN_Del, delete a file from memory
GN_Opf, open file/resource (wildcard search)
GN_Ren, rename file
GN_Mov, move file
OS_Cl, internal close (OZ usage) 
OS_Del, file delete (internal OZ usage) 
OS_Frm, file read miscellaneous 
OS_Fwm, file write miscellaneous 
OS_Gb, get byte from file (or device) 
OS_Gbt, get byte from file (or device) with timeout 
OS_Mv, move bytes between stream and memory
OS_Fdp, fast sector-level duplication of source file to target file
OS_Op, internal open (OZ usage) 
OS_Pb, write byte to file, device 
OS_Pbt, write byte to file, device with timeout 
OS_Ren, file rename (internal OZ usage)

web analytics