bobleny
08-08-2009, 08:54 AM
Hey, I have another question!
I have a binary file with a .rnd extension. I need to read the records. In QBASIC, it could be done like so:
OPEN fileLocation$ FOR BINARY AS #1
GET #1, recordNumber%, aDataStructure
CLOSE 1
From what I can tell, in VB this is how you would open a file:
Dim fileStream As New IO.FileStream(fileLocation, IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None)
Dim file As New IO.StreamReader(fileStream)
Dim records As String = file.ReadToEnd()
fileStream.Close()
Though this opens the file, I can only seem to read the first line... Maybe it's just me, but this seems to also be a bit more complicated than in QBASIC.
When I look up how to open a binary file in VB online, everyone says the same thing,
OPEN fileLocation$ FOR BINARY AS #1
GET #1, recordNumber%, aDataStructure
CLOSE 1
However, when I type that in, "Open" just doesn't exist...
Is anyone able to help me out? I don't understand.
Thanks!
I have a binary file with a .rnd extension. I need to read the records. In QBASIC, it could be done like so:
OPEN fileLocation$ FOR BINARY AS #1
GET #1, recordNumber%, aDataStructure
CLOSE 1
From what I can tell, in VB this is how you would open a file:
Dim fileStream As New IO.FileStream(fileLocation, IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None)
Dim file As New IO.StreamReader(fileStream)
Dim records As String = file.ReadToEnd()
fileStream.Close()
Though this opens the file, I can only seem to read the first line... Maybe it's just me, but this seems to also be a bit more complicated than in QBASIC.
When I look up how to open a binary file in VB online, everyone says the same thing,
OPEN fileLocation$ FOR BINARY AS #1
GET #1, recordNumber%, aDataStructure
CLOSE 1
However, when I type that in, "Open" just doesn't exist...
Is anyone able to help me out? I don't understand.
Thanks!