|
Post by QUIX on Jun 6, 2002 18:08:33 GMT
I was wondering how to copy files (An exe and a few txt files) to C:\ from A:\ . I want to write the program in QBASIC 1.1, can anyone help?
|
|
|
Post by brisray on Jun 6, 2002 21:18:08 GMT
To do something like this you need to use the SHELL command along with the DOS COPY command.
SHELL "copy c:\test.txt c:\brisray"
Will copy the file test.txt from the root directory of C: to the directory brisray.
One nice thing is that wildcards are supported. If I had three files named test1.txt, test2.txt and test3.txt then you could use
SHELL "copy c:\test*.txt c:\brisray"
or
SHELL "copy c:\test?.txt c:\brisray"
to copy them.
Another way is to open the files and write them a line or by a number of bytes at a time to new files but this is more complicated.
Copying files to a removable drive sounds easy enough, but if you add error checking to see if the drive is ready, or the disk is formatted etc. you can make the code as complicated as you like.
It may be easier just to warn the user that they should ensure they have a formatted disk in the drive, then use ON ERROR to catch any and all drive errors.
Ray
|
|
|
Post by QUIX on Jun 7, 2002 20:33:05 GMT
Thanx, that rocked !
|
|