M
millenium
Several related questions:
1. Can an ArrayList hold a Byte or a Char ?
why is this not working
Dim al As ArrayList
Dim ch As Char
ch = "c"
al.Add(ch)
2. Is the following code for reading in a binary file considered a good
way of doing it, it does work, but a little slowly.
FileOpen(2, "file.bin", OpenMode.Binary, OpenAccess.Read)
Dim uBound As Integer = 10000
Dim rx(uBound) As Byte
Dim ch As Byte
Dim i As Integer = 0
Console.WriteLine("please wait while file is loading")
While Not EOF(2)
FileGet(2, ch)
rx(i) = ch
If i = uBound Then
uBound += 10000
ReDim Preserve rx(uBound)
Console.Write(".")
End If
i += 1
End While
3. Lastly, if I only need to read a byte from the file at random location x,
do I need to read the file into an array as I have done above, or is there
a way to simply access one byte?
Thanks.
1. Can an ArrayList hold a Byte or a Char ?
why is this not working
Dim al As ArrayList
Dim ch As Char
ch = "c"
al.Add(ch)
2. Is the following code for reading in a binary file considered a good
way of doing it, it does work, but a little slowly.
FileOpen(2, "file.bin", OpenMode.Binary, OpenAccess.Read)
Dim uBound As Integer = 10000
Dim rx(uBound) As Byte
Dim ch As Byte
Dim i As Integer = 0
Console.WriteLine("please wait while file is loading")
While Not EOF(2)
FileGet(2, ch)
rx(i) = ch
If i = uBound Then
uBound += 10000
ReDim Preserve rx(uBound)
Console.Write(".")
End If
i += 1
End While
3. Lastly, if I only need to read a byte from the file at random location x,
do I need to read the file into an array as I have done above, or is there
a way to simply access one byte?
Thanks.