Copy files from a: to c: drive using qbasic

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
nancepa
Newbie
Posts: 2
Joined: Tue May 23, 2006 8:48 pm

Copy files from a: to c: drive using qbasic

Post by nancepa » Tue May 23, 2006 8:55 pm

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

RayBritton
Veteran
Posts: 109
Joined: Thu Feb 10, 2005 12:38 pm

Post by RayBritton » Wed May 24, 2006 3:40 am

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 /?

Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re » Wed May 24, 2006 4:50 am

Homework.
I have left this dump.

RayBritton
Veteran
Posts: 109
Joined: Thu Feb 10, 2005 12:38 pm

Post by RayBritton » Wed May 24, 2006 1:10 pm

I thought so, but I was in a good mood.

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

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

Post by moneo » Wed May 24, 2006 7:20 pm

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.
*****

User avatar
Theophage
Coder
Posts: 44
Joined: Sun May 07, 2006 7:32 pm
Location: Tucson, AZ
Contact:

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

Post by Theophage » Thu May 25, 2006 5:00 am

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)
Daniel "Theophage" Clark
theophage (at) geocities (dot) com

"God used to be my co-pilot, but our plane crashed in the mountains and I had to eat Him..."

nancepa
Newbie
Posts: 2
Joined: Tue May 23, 2006 8:48 pm

Thanks

Post by nancepa » Mon May 29, 2006 9:13 am

Thanks moneo, for your input I got it to work just as needed.

Nancepa

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: Thanks

Post by moneo » Mon May 29, 2006 6:41 pm

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
*****

Post Reply