Imports System
Imports System.IO
Imports System.Text
Module Module1
PrivateSub AddText(ByVal fs As FileStream, ByVal value AsString, ByVal c AsInteger)
Dim info AsByte() = New UTF8Encoding(True).GetBytes(value)
fs.Write(info, 0, c)
EndSub
PrivateFunction Commas2Pipe(ByVal line AsString) AsString
Dim o = ""
Return line
EndFunction
Sub Main(ByVal args() AsString)
Using fs As FileStream = File.Open(args(0), FileMode.Open)
Using fout As FileStream = File.Open(args(1), FileMode.OpenOrCreate)
Dim b(8000) AsByte
Dim c(8000) AsChar
Dim l AsInteger
Dim enc As UTF8Encoding = New UTF8Encoding(True)
Dim i AsInteger
Dim s AsString
Dim replace AsChar
replace = "|"
Do
l = fs.Read(b, 0, b.Length)
s = enc.GetString(b)
c = s.ToCharArray
For i = 0 To c.Length - 1
If c(i) = ","Then
c(i) = replace
EndIf
If c(i) = Chr(34) Then
If replace = "|"Then replace = ","Else replace = "|"
EndIf
Next
Dim info AsByte() = enc.GetBytes(c)
fout.Write(info, 0, l)
LoopWhile l > 0
fout.Flush()
fout.Close()
EndUsing
EndUsing
EndSub
EndModule