Sorry about the confusion. Eventually, I will need to go thru the entire file. But, first I need to retreive different values at
different addresses in the header of the file(s) that will give me other information that I am looking for.
Well, to be clearer, I am working on reading an old Dataflex database .DAT file(s) (63 Tables in 63 seperate files, all
different sizes and number of fields). At location H08 is the number of rows in the file, and at H59 the number of fields.
Also, there are addresses that contain the field type for each field and the field size for each field. Also, there is an
address that contains the size of the record After that comes a null record. Then the actual field data.
The field names are in a seperate, Text file.
I can open the .TAG file that contains the field names and I have the names for the fields in each table. (seperate .TAG file
for each table) Then, I need to open the .DAT file and extract the information to build the rest of the table and save it to an
Access database.
The reason I am not looping thru the file or just reading to the end, is I wanted to be able to actually go to a specific
address and read the value at that address correctly. Once I can accurately do that, I feel that I can then proccess the rest of
the file with little to no problems. As for using SeekOrigin.Begin or SeekOrigin.Current, that was just one of the options that
Intellisense offered that I have tried using to read the value(s) I needed. Nothing carved in stone as to using that specific
function.
As I said in my original post, I am open to suggestions on how to this. I am not stuck on using FileStream or anything else.
james
"Crouchie1998" <Cr**********@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com...
I am confused by your post
Are you having problems actiually reading a specific set block size of data?
Also, your RichTextBox only holds one piece of data & isn't appended to it.
RichTextBox.Text = add
Don't you mean:
RichTextBox.Text += add ' Keep appending, but you need to use a loop to do
it this way.
You also state 'SeekOrigin.Begin'. What about 'SeekOrigin.Current'?
How big is the data you want to read? How big is the blocksize you want to
read?
Please just clarify
"james" wrote:
I am trying to use Filestream to read a file ( .DAT) that contains values in HEX that I want to convert to text. I know the
different offset addresses for each portion of the data I am trying to retrieve. But, I am having problems actually reading
the
data for the number of Bytes that I need to get from each address.
Here is some of the code I am currently working with:
Dim fsread As FileStream = File.Open(OpenFileDialog1.FileName, FileMode.Open)
Dim add As String
add = fsread.Seek(&HD0, SeekOrigin.Begin)
RichTextBox1.Text = add
Catch ex As Exception
'display error messages if they appear
MessageBox.Show(ex.Message)
End Try
End If
Using the above code, I get the Dec value for D0 ( 208) , instead of reading the contents of the data at that particular
address.
Any ideas on what I am doing wrong?
james