Basic

Moderators: None (Apply to moderate this forum)
Number of threads: 1679
Number of posts: 4768

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
oh the confusion Posted by y2keable on 3 Nov 2003 at 3:32 PM
i'm getting my setup program to work great in that it can copy the .EXE files to a place on the hard disk. the only thing is, when i put the program onto a floppy disk, the files are extracted not to the hard disk but onto the floppy disk, like its ignoring my CHDIR$ command.

hears how it goes...

my setup program displays a file path to the user, if he/she dont like it, they can change it.

The file path gets saved in a file for later use (it has to be used by a different program later on and the COMMON SHARED AS STRING wont work cos I have too many of them.)

After a few setup screens, the files are ready to be copied so I use the following code

OPEN Allocation FR NPUT AS #1
INPUT #1, UserDirectory$
CLOSE

OPEN <file to be copied> FOR BINARY AS #1

CHDIR UserDirectory$ e.g. C:\Progra`1 (program files)

OPEN <file to be put on HDD> FOR BINARY AS #1

Then the code copies the file from the current directory to the one set by the user.


This works fine as long as the setup program and the program to be moved are on the hard drive (i.e. C:\Programming\QBASIC) but I simply click and drag the two files onto a floppy disk and the program still runs fine except that the files and the program are not put in the users allocation, theyre put on the floppy disk.

Anyone know why this is? Id put all my code in the message only its so big and there are 2 files. So if anyone wants to see the code then e-mail me at y2keable@hotmail.com note the files i'm talking about are compiled into .exe

Cheers

Report
Re: oh the confusion Posted by the walrus on 3 Nov 2003 at 4:45 PM
This message was edited by the walrus at 2003-11-3 16:46:57

do this

OPEN UserDirectory$ + "\" + <file to be put on HDD> FOR BINARY AS #1

i think you can also change the drive using CHDRIVE and then use CHDIR if that's how you want to do it, but you don't really even need to use CHDIR, because you can just open the entire path + filename and do it all at once.

(and I don't know how you've got UserDirectory$ stored, but if you've already got the "\" at the end then do this instead: OPEN UserDirectory$ + <file to be put on HDD> FOR BINARY AS #1)





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.