read file

totoblj

New member
Joined
Jun 6, 2006
Messages
1
Programming Experience
1-3
i a vb express 2005 programming
i want to write a program to read a file and store contents file in a array.
eg :
i have a coba.txt file : abcdefgh
i want to make array baca_coba,
baca_coba(1) = a
baca_coba(2) = b
baca_coba(3) = c
baca_coba(4) = d
baca_coba(5) = e
...
i write program :
VB.NET:
Dim openFileDialog1 As New OpenFileDialog()
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
openFileDialog1.FileName = "F:\sementara\coba.txt"
openFileDialog1.FilterIndex = 1
Dim encoding As System.Text.Encoding = System.Text.Encoding.Default
Dim filen As New StreamReader(openFileDialog1.FileName, encoding)
Dim i As Integer
Dim baca_coba(),baca As string
For i = 1 To 10
baca = Int(filen.Read())
baca_coba(i) = chr(baca)
Next
but my program is error, how to make a program to this problem?
if i have a file with unknown unicode. how to write program to know
what type unicode from that file.
eg : from file baca_coba file above, when i click button, a message show with
information: BigEndian unicode
 
Last edited by a moderator:
Back
Top