Notifications
Clear all

[Closed] Created File Isn't Closing

I’m creating a file that I will be writing data into – I will be writing an xml file. I’m at early stages yet, and I’m making good progress – apart from the fact that once I have created and written to a file, I cannot seem to close it.

The below code is the portion I use – it seems to create and edit the file correctly, but once that’s done, and I attempt to delete it, I’m told the file isn in use.
Likewise, if I drag it into explorer edit it, then save, it says it cannot create the file.

what’s wrong with the closing code I am using?

thanks.

   
-- writing the xml file package

-- what shall we call the XML file?

thexmlfile = thehtmlpath + edit_object_name.text + ".txt"

--create the new xmlfile

createFile thexmlfile

--open the xmlfile for editing

fxml=fopen thexmlfile "a+"

--writing data into the xml file

WriteString fxml "String"

fclose fxml


1 Reply

OK, this is what happens when you start hacking through the help files and piecing things together – a method that works some of the time, but not all the time.

anyway; anyone who finds themselves in the same area as me could do worse than read this thread.

The long and short of it is, mind that you arent mixing your binary files with your text files… otherwise your face could literally disolve off of yourhead, like mine did.

http://forums.cgsociety.org/showthread.php?t=384605&highlight=format+quotes

Amongst this is the code you’re looking for.

 -- writing the xml file package 
-- what shall we call the XML file?
thexmlfile = thehtmlpath + edit_object_name.text + ".txt"
--create the new xmlfile
fxml = createFile thexmlfile
--open the xmlfile for editing
--openfile fxml a+
--writing data into the xml file
---WriteString fxml "String"
format "%
" edit_object_name.text to: fxml
close fxml