Ask a Question related to Macromedia Director Lingo, Design and Development.
-
Eelco Heuvelmans webforumsuser@macromedia.com #1
File IO won't delete txt file
Hi,
I just wrote this script so that when I change something in a list in the projector, this list is saved in an external txt file..
the problem only is, the delete function of File IO doesn't work properly (Or I'm doing something wrong..).
But when I don't include the delete function, the list is correctly written to the file, but when the new list is shorter, it just overwrites the number of characters needed and leeves the remaining characters intact...
example:
old list: [1,2,3,4,5,6], new list: [1,2]
when I write the new list to the text file the result looks like this:
[1,2]3,4,5,6], but 3,4,5,6] should actually be gone..
Does anyone know what I'm doing wrong??
Tnx
Eelco
--
This is my script:
global list
on writedown
fName=the moviepath&"lists\data.txt"
tekst=list.string
io = new(Xtra "fileIO")
io.openFile(fName, 0)
io.deleteFile(fName)
io.createFile(fName)
io.openFile(fName, 0)
io.writeString(text)
io.closeFile()
io = VOID
castLib("fieldstorage").save(the moviePath & "fieldstorage.cst")
end
Eelco Heuvelmans webforumsuser@macromedia.com Guest
-
I can't delete file
Dear all, I can't delete file.. When my hdd was full, my set was down... After rebooting, hdd error detected and repair file system. but 16 GB... -
How to delete a file from the file system
Hi, Is there any module which has methods that can be used to delete a file from the filesystem in the windows NT environment. Thanks in... -
Delete File Asp.NET Error: File is used by another process
Please, help! I have set Permission to Full Control to the user ASPNet_wp account to my Security folder. I have set UserName = "System"... -
cannot delete a file
Charles, This is a network newsgroup, so how did this affect your network? The information you provide implies that the file is in a different... -
Delete a file while its in use
Do a search from yesterday posted by "AR" entitled - Cannot delete certain MP3 & WMA files - There are several suggesstions posted. -- Harry... -
Christian Grass #2
Re: File IO won't delete txt file
seems strange to me. your script looks correct. just in case you won't get
a workaround, try the "File4Xtra"
[url]http://kblab.net/xtras/[/url]
it's a free xtra and can do everything that the fileIO xtra can do, also
has more functions like creating folders etc.
On Thu, 4 Dec 2003 10:55:32 +0000 (UTC), Eelco Heuvelmans
<webforumsuser@macromedia.com> wrote:
> Hi,
> I just wrote this script so that when I change something in a list in
> the projector, this list is saved in an external txt file..
> the problem only is, the delete function of File IO doesn't work
> properly (Or I'm doing something wrong..).
> But when I don't include the delete function, the list is correctly
> written to the file, but when the new list is shorter, it just
> overwrites the number of characters needed and leeves the remaining
> characters intact...
>
> example:
>
> old list: [1,2,3,4,5,6], new list: [1,2]
>
> when I write the new list to the text file the result looks like this:
>
> [1,2]3,4,5,6], but 3,4,5,6] should actually be gone..
>
> Does anyone know what I'm doing wrong??
>
> Tnx
>
> Eelco
> --
> This is my script:
>
> global list
>
> on writedown
>
> fName=the moviepath&"lists\data.txt"
> tekst=list.string
> io = new(Xtra "fileIO")
> io.openFile(fName, 0)
> io.deleteFile(fName)
> io.createFile(fName)
> io.openFile(fName, 0)
> io.writeString(text)
> io.closeFile()
> io = VOID
>
> castLib("fieldstorage").save(the moviePath & "fieldstorage.cst")
>
> end
>
>
>Christian Grass Guest
-
Ned #3
Re: File IO won't delete txt file
you can't delete an opened file :
fName=the moviepath&"lists\data.txt"
tekst=list.string
io = new(Xtra "fileIO")
-- io.openFile(fName, 0) -- here
io.deleteFile(fName)
io.createFile(fName)
io.openFile(fName, 0)
io.writeString(text)
io.closeFile()
io = VOID
hth
--
----------------
-- Ned
----------------------------------------
Bien faire et laisser braire
----------------------------------------
"Eelco Heuvelmans" <webforumsuser@macromedia.com> a écrit dans le message de
news:bqn3r4$r64$1@forums.macromedia.com...
| Hi,
| I just wrote this script so that when I change something in a list in the
projector, this list is saved in an external txt file..
| the problem only is, the delete function of File IO doesn't work properly
(Or I'm doing something wrong..).
| But when I don't include the delete function, the list is correctly
written to the file, but when the new list is shorter, it just overwrites
the number of characters needed and leeves the remaining characters
intact...
Ned Guest
-
johnAq webforumsuser@macromedia.com #4
Re: File IO won't delete txt file
A quick look suggests that your line
io.deleteFile(fName)
is incorrect (I don't know why it doesn't give error), try
io.delete()
hth
johnAq
johnAq webforumsuser@macromedia.com Guest
-
Eelco Heuvelmans webforumsuser@macromedia.com #5
Re: File IO won't delete txt file
tnx, it worked!
Eelco Heuvelmans webforumsuser@macromedia.com Guest



Reply With Quote

