I have open my file without problems and change the data i want.
The lines is stored in array like the screenshot below.
The problem is when i save the new file is a mess !!
Can someone point me where or what i do wrong?
The code to read my file.
Dim ThenewLine as string
Dim ErrorText As Text
Try
Dim input As TextInputStream
input = TextInputStream.Open(TargetFile, TextEncoding.UTF8)
Dim testArray(-1) as string
Dim line as string
While Not input.EOF
TotalLines = TotalLines + 1
Line = input.ReadLine
ThenewLine=ReadTheLine(line)
NewFile.Append ThenewLine
Wend
input.Close
break //to see the results
Catch e As IOException
ErrorText = "File IO Error: " + e.Reason
End Try
and this is to save the file
Dim NewLine As text
Dim output As TextOutputStream
Try
For i As Integer = 0 To NewFile.Ubound
NewLine = NewFile(i).ToText
output = TextOutputStream.Append(TargetFile, (Xojo.Core.TextEncoding.UTF8))
output.Write NewLine
Next
output.Close
Catch e As IOException
MsgBox "Error"
End Try
The first screenshot is from Array and is perfect like the original file
Second screenshot is the comparison of the 2 files (Left is Original file <>Right the new saved file)
http://i.imgur.com/vQPyinv.png
http://i.imgur.com/b7Hju95.png
Thank you