I'm reading a txt file into an array and then writing a new file one line at a time. The reason i'm using array is that i'm searching for a few lines that i want to find and replace.
However in my file I have some ascii characters but they aren't read well. I read something about System.Text.Encoding.Default but I don't know how to implement it in my code. Can anyone help me with this?
Here's my code
Code:Dim line As New List(Of String) line.AddRange(IO.File.OpenText("C:\hello.txt").ReadToEnd.Split(Environment.NewLine)) 'System.Text.Encoding.Default Using sw As StreamWriter = File.CreateText("C:\goodbye.txt") Dim linel As String For Each linel In line sw.WriteLine(linel) Next sw.Flush() End Using





Reply With Quote