Crew .NET |
|
Wegschrijven:
Dim words = New String() {"een", "twee", "drie"}
Using fs As FileStream = New FileStream("C:\Temp\array.txt", FileMode.Append, FileAccess.Write)
Dim encoder = New UTF8Encoding()
Dim bytes As Byte()
For Each word As String In words
bytes = encoder.GetBytes(word + "|")
fs.Write(bytes, 0, bytes.Length)
Next
bytes = encoder.GetBytes(vbNewLine)
fs.Write(bytes, 0, bytes.Length)
End Using
Dim words = New String() {"een", "twee", "drie"} Using fs As FileStream = New FileStream("C:\Temp\array.txt", FileMode.Append, FileAccess.Write) Dim encoder = New UTF8Encoding() Dim bytes As Byte() For Each word As String In words bytes = encoder.GetBytes(word + "|") fs.Write(bytes, 0, bytes.Length) Next bytes = encoder.GetBytes(vbNewLine) fs.Write(bytes, 0, bytes.Length) End Using
Uitlezen:
Using sr As StreamReader = New StreamReader("C:\Temp\array.txt", Encoding.UTF8)
For Each line As String In sr.ReadToEnd().Split(vbNewLine)
For Each word As String In line.Split("|")
Console.Write(word & " ")
Next
Next
End Using
Using sr As StreamReader = New StreamReader("C:\Temp\array.txt", Encoding.UTF8) For Each line As String In sr.ReadToEnd().Split(vbNewLine) For Each word As String In line.Split("|") Console.Write(word & " ") Next Next End Using
|