Echo Project #1

 BBS: Inland Empire Archive
Date: 02-16-93 (14:51)             Number: 218
From: ZACK JONES                   Refer#: NONE
  To: ALL                           Recvd: NO  
Subj: Echo Project #1                Conf: (2) Quik_Bas
Howdy All!

Ok - it's time to get an echo-wide programmng project
going.  For our first one I'd like to take this filecopy
sub routine and make some enhancements to it. First I'll
post the sub routine and then I'll provide a list of
enhancements I'd like to add.  Here's the subroutine:

SUB FileCopy (Source$, Dest$)
'This sub opens two files in binary mode and then copies the contents
'of the first file into the second file.  It displays a %meter showing
'the percent complete as the file is copied.
'Credit goes to Matt Hart for some suggested changes already implemented

    X = 1: REDIM Transfer(1 TO X) AS STRING * 1024

    OPEN Source$ FOR BINARY AS 1

    Length& = LOF(1)
    Total& = 0

        GET #1, , Transfer(1)

           IF Total& + LEN(Transfer(1)) <= Length& THEN
              Trans$ = Transfer(1)
              Trans$ = LEFT$(Transfer(1), Length& - Total&)
           END IF

           Total& = Total& + LEN(Trans$)

        PUT #2, , Trans$

        Complete% = INT((Total& / Length&) * 100)

         LOCATE 14, 35: COLOR 15: PRINT USING "###% complete! "; Complete%;
         LOCATE 15, 17: PRINT STRING$(Complete% \ 2, 219);
        IF Total& >= Length& THEN EXIT DO


Ok - not too much to it is there.  I'd to add the following enhancements:

1 - ability to use wild cards.
2 - ability to call the routine with just the source filename and
    path to copy the file to.
3 - an error handler for disk errors
4 - a nice windowing routine to display the whole process in a window
    (I have source for that so I'll add that part first)
5 - the ability to delete the source file if we wanted to.
6 - Anything else you folks can think of that would be nice to add.

Please provide your suggestions/code to me and I'll add
them to the program. Remember - all code used is considered
public domain and anyone can use it for any purpose.

Take Care, Zack Jones
--- GoldED 2.41.B1207+1536
 * Origin: Zack's Shack San Antonio TX (210) 653-2115 (1:387/641)
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