AllSystemGo Posted June 4, 2008 Posted June 4, 2008 Ok here is my code, the question is going to follow #include <File.au3> Dim $aRecords, $text $text = FileRead(somefile) $aRecords = StringSplit($text, @CRLF, 1) For $x = 1 to $aRecords[0] If StringInStr($aRecords[$x], "TB04") Then $aRecords[$x] = $aRecords[$x] & " TestJF" EndIf Next MsgBox(0, "", $aRecords[0]) MsgBox(0, "", $aRecords[1]) MsgBox(0, "", $aRecords[2]) _FileWriteFromArray(somefile, $aRecords, 1) So here I read a whole file in memory, then I modify stuff in the array. Until now everything works fine, except when I write to the same file, for some reason it doesn't write from the start of the file it put a blank then start to write. I've check in my array and the blank line isn't in there. What am I doing wrong?? Thank you for your help
weaponx Posted June 4, 2008 Posted June 4, 2008 Ok here is my code, the question is going to follow #include <File.au3> Dim $aRecords, $text $text = FileRead(somefile) $aRecords = StringSplit($text, @CRLF, 1) For $x = 1 to $aRecords[0] If StringInStr($aRecords[$x], "TB04") Then $aRecords[$x] = $aRecords[$x] & " TestJF" EndIf Next MsgBox(0, "", $aRecords[0]) MsgBox(0, "", $aRecords[1]) MsgBox(0, "", $aRecords[2]) _FileWriteFromArray(somefile, $aRecords, 1) So here I read a whole file in memory, then I modify stuff in the array. Until now everything works fine, except when I write to the same file, for some reason it doesn't write from the start of the file it put a blank then start to write. I've check in my array and the blank line isn't in there. What am I doing wrong?? Thank you for your help This is a bug in 3.2.10.0 I think. It should be fixed in 3.2.12.0.
AllSystemGo Posted June 4, 2008 Author Posted June 4, 2008 (edited) Wow thxs for the fast reply!! Is there a ETA on when the next update will come out?? BTW: Is there a way to fix that temporarly ??? I mean do I need to parse the whole file and rewrite it?? Edited June 4, 2008 by AllSystemGo
weaponx Posted June 4, 2008 Posted June 4, 2008 (edited) Wow thxs for the fast reply!! Is there a ETA on when the next update will come out?? BTW: Is there a way to fix that temporarly ??? I mean do I need to parse the whole file and rewrite it?? You can easily write your own function. Func _WriteArrayToFile($aArray, $sFilename) Local $handle = FileOpen($sFilename,2) For $X = 0 to Ubound($aArray)-1 FileWriteLine($handle,$aArray[$X]) Next FileClose($handle) EndFunc Edited June 4, 2008 by weaponx
AllSystemGo Posted June 4, 2008 Author Posted June 4, 2008 Thank you for your help Weaponx. You were right in the version 3.12.0 it got fixed and it's out already!! Cheers
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