
    SIZE = 512
    buffer = space(SIZE)

    ACCEPT "Source file:  " TO source
    ACCEPT "Target file:  " TO target
    ?

    * Try to open source file in read only mode, the default
    ifile = FOPEN(source)

    IF ferror() != 0
        ? source, " could not be opened"
        QUIT
    ENDIF
 

    * Try to create output file with read write attributes
    ofile = FCREATE(target)

    IF ferror() != 0
        ? target, " Could not be created"
        QUIT
    ENDIF

    num_read = fread(ifile, @buffer, SIZE)

    * while read a buffer full ... (!eof()) 
    DO WHILE num_read = SIZE

        fwrite(ofile, buffer, SIZE)        
        num_read = fread(ifile, @buffer, SIZE)

    ENDDO

    * write final partial buffer 
    fwrite(ofile, buffer, num_read)

    * finally, close the two files

    fclose(ifile)
    fclose(ofile)
