Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / copy file function?

Author
Message
TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 25th Mar 2008 17:20 Edited at: 26th Mar 2008 00:24
Hey guys!

My brain is oozing out of my ears, because it has been thinking too har about this stupid problem.

The "copy file" function can only copy a file from one file to another in the SAME directory. I need to copy it into a different directory.
This is what I have tried until now:

1) I tried to "copy file" into the same directory, but the "move file" command only moves it in the SAME directory, not out of the directory! I can`t find a way to move it out

2)


Before anyone asks:Yes, I have checked if the file already exists and that the source exists

Any ideas?

Thanks, TheComet

Oooooops!!! I accidentally formated drive c.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Mar 2008 18:40 Edited at: 26th Mar 2008 23:49
Quote: "The "copy file" function can only copy a file from one file to another in the SAME directory."


If it only did that it would be a completely useless command.

You've not supplied a snippet showing what code you used for the Copy File or Move File commands, so it's impossible to say what you've done wrong.

Your method 2 will not work because

1) The file you are trying to copy (a WAV file) is a binary file, but you are using commands designed to read/write strings.

2) You have file$="hello.wav" at the top but when accessing the file you use current_dir$+filename$. So, the file wouldn't exist even if you weren't trying to read/write strings.

Method 1 should work fine, so post a short program using Copy File or Move File which doesn't work and then we'll be able to help.

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 26th Mar 2008 23:39
Quote: "If it only did that it would be a completely useless command."


Whoops! It must have been 2 in the morning, because I wasn't thinking straight! The Copy File function can copy files to anywhere. But if I do it with any sound or music file, it doesn't work!

Any help? I get the CLI error "Could not load music"

Thanks, TheComet

Oooooops!!! I accidentally formated drive c.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Mar 2008 23:52
Quote: "But if I do it with any sound or music file, it doesn't work"


Impossible - the commands have no way to distinguish a sound or music file from any other file.

I repeat once again, from my last post:

"post a short program using Copy File or Move File which doesn't work and then we'll be able to help"

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Mar 2008 00:08
Quote: ""post a short program using Copy File or Move File which doesn't work and then we'll be able to help""


Sure thing! Here you go:



Quote: "Impossible - the commands have no way to distinguish a sound or music file from any other file."


Try using the above code to copy a ".xm" format. The file at the destination will be corrupt.

Oooooops!!! I accidentally formated drive c.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Mar 2008 02:22
Works fine.

I created a folder called A and a folder called B in the project folder and placed the file aa_siren.xm into folder A (one of only two .XM files on my whole system)!

I then ran the following code:



The copied file played in Winamp with no problem.

I then used:



Once again, the .XM played perfectly.

TDK_Man

TheComet
17
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 27th Mar 2008 16:46 Edited at: 27th Mar 2008 16:47
Try this:



It plays with the xmplayer, but when I load the copied file into DarkBasic, it can`t load the music.

Oooooops!!! I accidentally formated drive c.

Login to post a reply

Server time is: 2025-06-04 03:24:59
Your offset time is: 2025-06-04 03:24:59