COPY command from QB

 BBS: Inland Empire Archive
Date: 07-23-92 (13:07)             Number: 176
From: TOM HAMMOND                  Refer#: NONE
  To: BOB SEWELL                    Recvd: NO  
Subj: COPY command from QB           Conf: (2) Quik_Bas
JJ>In a message of <13 Jul 92  06:34:44>, Bob Sewell (1:116/5) writes:

JJ> >   Anyone know how to access the DOS COPY command from within
JJ> >QB, without resorting to the SHELL "copy \path1\file1 \path2"
JJ> >statement?

Bob:

Matt Hart posted a really fast COPY routine a while back.. let me see if
I can find it among all the SAVEd posts and...  ah, yes, here it is.
Use it in good health:


    'This subroutine does a QUICK copy of one file to another

    DECLARE SUB CopyFile (CFileIn$, CFileOut$)

    INPUT "File to copy"; CFileIn$
    INPUT "New Name?"; CFileOut$

    CALL CopyFile(CFileIn$, CFileOut$)

SUB CopyFile (CFileIn$, CFileOut$)

    CFileIn = FREEFILE
    OPEN CFileIn$ FOR BINARY AS #FileIn

    CFileOut = FREEFILE
    OPEN CFileOut$ FOR BINARY AS #FileOut

    A$ = SPACE$(4096)

    FOR i = 1 TO LOF(1) \ 4096    ' note backslash
        GET CFileIn, , A$
        PUT CFileOut, , A$
    NEXT i

    IF LOF(1) MOD 4096 > 0 THEN
        A$ = SPACE$(LOF(1) MOD 4096)
        GET 1, , A$
        PUT 2, , A$
    END IF

    CLOSE CFileIn, CFileOut
END SUB
--------------------8<-------- Clip here -------->8---------------

Good luck

Tom Hammond            N0SS
---
 þ SLMR 2.1 þ hAS ANYONE SEEN MY cAPSLOCK KEY?


--- WM v2.00/91-0231
 * Origin: The Modem Zone BBS (314) 893-5106 (1:289/2)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET