Ace08 Posted October 14, 2010 Share Posted October 14, 2010 guys another quick question here, when i a FileOpen($FileName) does the script realy opens the file or does the script saves the contents in a memory? because what i would like to do is change a certain line in a file then just append the other lines? Work smarter not harder.My First Posted Script: DataBase Link to comment Share on other sites More sharing options...
Spiff59 Posted October 14, 2010 Share Posted October 14, 2010 It creates a handle, or link, to the file. Windows will then consider the file open, or in-use, until the handle is closed. None of the data in the file is read into memory with FileOpen(). Sounds like you might just want to do a _FileReadToArray(), then modify whatever line(s) you want, then do a _FileWriteFromArray(). There are examples for those commands in the helpfile . Link to comment Share on other sites More sharing options...
Mison Posted October 14, 2010 Share Posted October 14, 2010 guys another quick question here, when i a FileOpen($FileName) does the script realy opens the file or does the script saves the contents in a memory? because what i would like to do is change a certain line in a file then just append the other lines? Just like what Spiff59 has said, FileOpen does nothing to the file content. What it does is creates a "handle". Here are some examples: 1. Read, Change, Save ; read data $data = FileRead("xxx.txt"); you can use FileOpen, if you want to. ;~ $file = FileOpen("xxx.txt",0) ;~ $data = FileRead($file) ;~ FileClose($file) $data = StringReplace($data,"b",""); Replace 'b' with empty string a.k.a delete char 'b' ;open file in erase previos data mode $file = FileOpen("xxx.txt",2) FileWrite($file,$data) FileClose($file) xxx.txt, before aaa bbb ccc xxx.txt, after aaa ccc 2. Save, append to end of file $file = FileOpen("xxx.txt",1) FileWrite($file,"ddd") FileClose($file) or simply FileWrite("xxx.txt","ddd") "xxx.txt" - before aaa bbb ccc "xxx.txt" - after aaa bbb cccddd Hi ;) Link to comment Share on other sites More sharing options...
Ace08 Posted October 14, 2010 Author Share Posted October 14, 2010 (edited) Thanks a lot guys for the info Oh and one more thing is there a way to edit the contents in a GUIListView? got this one Thanks Edited October 14, 2010 by Ace08 Work smarter not harder.My First Posted Script: DataBase Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now