Hi,
I need to read a dbase III file (*.dbf), change a few records and write it back.
As I do not know a better way to do it, I'm trying to open it as a binary file,
I tried reading help on binary files but couldn't get what I need to know.
Question1:
I managed to read one file, in binary mode, using ReadBytes, but got an error message when trying to assign what I read to a string using BytesToString (help file says BytesToString returns a string):
length = bin.ReadBytes(buffer(),5)
Version = bin.BytesToString(buffer(),1,3)
What am I missing?
Question2:
I have a text file that has just two chars "AB".
A is ASCII 65 (41HEX) and B is ASCII 66 (42HEX).
I read the file in binary mode using
in_data = bin.ReadInt16
and printed in_data in a MsgBox; got the decimal value 16961, which means (I think) that those bytes are dealt in reverse order "BA", otherwise I would get for "AB" = 41HEX 42HEX = 16706 decimal.
Is that so, I mean, are bytes in binary numbers written in reverse order?
I need to read a dbase III file (*.dbf), change a few records and write it back.
As I do not know a better way to do it, I'm trying to open it as a binary file,
I tried reading help on binary files but couldn't get what I need to know.
Question1:
I managed to read one file, in binary mode, using ReadBytes, but got an error message when trying to assign what I read to a string using BytesToString (help file says BytesToString returns a string):
length = bin.ReadBytes(buffer(),5)
Version = bin.BytesToString(buffer(),1,3)
What am I missing?
Question2:
I have a text file that has just two chars "AB".
A is ASCII 65 (41HEX) and B is ASCII 66 (42HEX).
I read the file in binary mode using
in_data = bin.ReadInt16
and printed in_data in a MsgBox; got the decimal value 16961, which means (I think) that those bytes are dealt in reverse order "BA", otherwise I would get for "AB" = 41HEX 42HEX = 16706 decimal.
Is that so, I mean, are bytes in binary numbers written in reverse order?