Save file to directory. (OpenFile #MODE_WRITE command)

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Save file to directory. (OpenFile #MODE_WRITE command)

Post by Bugala »

I am trying tosave file to a directory using simply naming "Directory/filename.end" ie. '
OpenFile(1, "directory/filename.end", #MODE_WRITE)

It however fails.

Am i doing something wrong, or is this a windows problem, and if it is a windows problem (permission problem) then is there anything i can do within hollywood so that people using it on their machines would get it to work the way it is intended, or should i revert to saving everything to just the main folder in windows machines?
zylesea
Posts: 227
Joined: Tue Feb 16, 2010 12:50 am
Location: Westfalen/Germany
Contact:

Re: Save file to directory. (OpenFile #MODE_WRITE command)

Post by zylesea »

Bugala wrote:I am trying tosave file to a directory using simply naming "Directory/filename.end" ie. '
OpenFile(1, "directory/filename.end", #MODE_WRITE)

It however fails.

Am i doing something wrong, or is this a windows problem, and if it is a windows problem (permission problem) then is there anything i can do within hollywood so that people using it on their machines would get it to work the way it is intended, or should i revert to saving everything to just the main folder in windows machines?

openfile() expects a string. Yow need to concatonate the string. (Directory .. "/" .. filename.end). Or just change directory first to your destination directory with changedirectory().
User avatar
Juan Carlos
Posts: 887
Joined: Mon Sep 06, 2010 1:02 pm

Re: Save file to directory. (OpenFile #MODE_WRITE command)

Post by Juan Carlos »

With Changedirectory is more easy, other problem when you copy a file with the same name, overwrite it. The rename file also has a problem when there is a file with the same name.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Save file to directory. (OpenFile #MODE_WRITE command)

Post by Bugala »

Ah, didnt know about that ChangeDirectory command, will check from manual about that command. It will probably solve the problem. Thanks zylesea and Juan Carlos.
Post Reply