I'm having trouble opening and reading files, and also having some trouble writing them.
I'll start with the code for reading, because obviously that comes first
Code for reading:
Sub ReadFile(fileName As String)
Dim stream As StreamReader = New StreamReader(TFTPDir & fileName)
Dim N As Integer = 0
Try
Do
lineRead(N) = stream.ReadLine()
MsgBox(lineRead(N))
N = N + 1
Loop Until lineRead Is Nothing
lines = CInt(N)
N = 0
Catch ex As Exception
MsgBox("Didn't work")
End Try
If fileName = "cal_init*" Then CalFile()
If fileName = "radio_init*" Then RadioFile()
If fileName = "network*" Then NetworkFile()
GenerateFile(lines, fileName)
End Sub
TFTPDIR and fileName are declared earlier in the code.
This code always catches an exception, I'm sure the file is there, but I don't know if theres some sort of initialization I need to do before I try and read it.
Anyone know what's wrong?
I'll start with the code for reading, because obviously that comes first
Code for reading:
Sub ReadFile(fileName As String)
Dim stream As StreamReader = New StreamReader(TFTPDir & fileName)
Dim N As Integer = 0
Try
Do
lineRead(N) = stream.ReadLine()
MsgBox(lineRead(N))
N = N + 1
Loop Until lineRead Is Nothing
lines = CInt(N)
N = 0
Catch ex As Exception
MsgBox("Didn't work")
End Try
If fileName = "cal_init*" Then CalFile()
If fileName = "radio_init*" Then RadioFile()
If fileName = "network*" Then NetworkFile()
GenerateFile(lines, fileName)
End Sub
TFTPDIR and fileName are declared earlier in the code.
This code always catches an exception, I'm sure the file is there, but I don't know if theres some sort of initialization I need to do before I try and read it.
Anyone know what's wrong?