Page 1 of 1

Copy files from a: to c: drive using qbasic

Posted: Tue May 23, 2006 8:55 pm
by nancepa
Hello

Basically I want to write a program in qbasic that will copy the contents of one file thats on my floppy drive and insert it into another file thats on my hard drive. I do not want to overwrite the contents of the file on the hard drive. Is there a way and can someone show me?

Thanks
Nancepa

Posted: Wed May 24, 2006 3:40 am
by RayBritton
If you use the function SHELL and COPY eg

Code: Select all

SHELL "COPY A:\file.fil C:\"
for more information, use DosBox or command prompt and type COPY /?

Posted: Wed May 24, 2006 4:50 am
by Z!re
Homework.

Posted: Wed May 24, 2006 1:10 pm
by RayBritton
I thought so, but I was in a good mood.

Re: Copy files from a: to c: drive using qbasic

Posted: Wed May 24, 2006 7:20 pm
by moneo
nancepa wrote:.....
I want to write a program in qbasic that will copy the contents of one file thats on my floppy drive and insert it into another file thats on my hard drive. I do not want to overwrite the contents of the file on the hard drive.
What do you mean by INSERT IT INTO ANOTHER FILE? If you mean stick it on the front or stick it on the end of the other file, it can easily be done. However, if you really want to insert it in the middle somewhere, then the program can get complicated.

Ok, let's assume you want to insert it on the end of the other file already on the C: drive, and that the name of this file is CCC and is on the root directory of the C: drive. Let's assume that the file on the A: drive is called AAA and is also on the A:\ directory. This is how you could do it:
SHELL "COPY C:\CCC+A:\AAA /B C:\TEMP"

The /B file tells the COPY utility to treat the data on these files as binary, so it can copy and combine any kind of file.

This puts the combined file into a temportary file called C:\TEMP.
You did not overwrite the CCC file, but if you need to, you can copy TEMP to CCC.

Next time, please be more specific with your specifications.
*****

Re: Copy files from a: to c: drive using qbasic

Posted: Thu May 25, 2006 5:00 am
by Theophage
Next time, please be more specific with your specifications.
How can I rule the world using QBasic, a cable internet connection, and half a one-liter of Mountain Dew? (please note that ruling a significant portion of the world is good enough for this exercise)

Thanks

Posted: Mon May 29, 2006 9:13 am
by nancepa
Thanks moneo, for your input I got it to work just as needed.

Nancepa

Re: Thanks

Posted: Mon May 29, 2006 6:41 pm
by moneo
nancepa wrote:Thanks moneo, for your input I got it to work just as needed.

Nancepa
Your very welcome. Glad to hear that you got it to work.

Regards,
Edward F. Moneo
*****