
0 VALUE idfR
0 VALUE idfW

\ - FILE-COPY-BUF VARIABLE FILE-COPY-BUF $80000 ALLOT 
0 VALUE FILE-COPY-BUF

$8000 VALUE FCOPY-BUF-SIZE

: COPY_FILE ( adrR lenR adrW lenW -- )
  (   \ idfR idfW  -- )
 FCOPY-BUF-SIZE ALLOCATE THROW TO FILE-COPY-BUF
 R/W CREATE-FILE THROW TO idfW
 R/O OPEN-FILE THROW TO idfR
 BEGIN
   FILE-COPY-BUF
   FILE-COPY-BUF FCOPY-BUF-SIZE idfR READ-FILE  THROW
   TUCK			 idfW WRITE-FILE  THROW
  FCOPY-BUF-SIZE <>
 UNTIL 

   idfR CLOSE-FILE  THROW
   idfW CLOSE-FILE  THROW

 FILE-COPY-BUF FREE DROP

;

: FCOPY  ( -- )
	PARSE-NAME PARSE-NAME COPY_FILE ;

