erezlevi Posted January 4, 2008 Share Posted January 4, 2008 hi, all. how can I erase lines from the end of file after opening it for edit: $file=FileOpen ("c:\0522554720.htm",1) I want to erase lines from the end of the file. Link to comment Share on other sites More sharing options...
BrettF Posted January 4, 2008 Share Posted January 4, 2008 _FileReadtoArrayThe for loop, and filewriteline.But how do you not write the last lines? The secret is in the to of the for loop. see if you can work it out. Hint, expressions can be used... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BigDod Posted January 4, 2008 Share Posted January 4, 2008 You could use _FileCountLines to get the number of the last line in the file and then use _FileWriteToLine without any text to delete the line without having to open the file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
erezlevi Posted January 4, 2008 Author Share Posted January 4, 2008 You could use _FileCountLines to get the number of the last line in the file and then use _FileWriteToLine without any text to delete the line without having to open the file. Thanks for your responses, I'v choose the : $filechange=_FileWriteToLine("c:\0522554720.htm",85, "my replacement for line 85", 1) it erases the part i don't need from previus action and replaces it with new data continuasly. instead of using "my r...." i will use an $i string that allways changes. Link to comment Share on other sites More sharing options...
randallc Posted January 4, 2008 Share Posted January 4, 2008 Hi, Don't forget the link in my sig for superfast read/ write / delete at end of file, as you don't even need to read the file! (APITailRW.zip) Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW 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