Click to See Complete Forum and Search --> : show data from hex address
Peter van Collenburg
Dec 11th, 1999, 05:45 AM
Hello,
I've a dBase III database, in that database there is in HEX a reference to an other file.
This referencefield contains the following 7 bytes: 00 4b 00 25 c9 00 00
The 3rd and 2nd position is the hex value of the length and the 5th and 4th character is the hex value of the starting point in the reference file.
I've in my form somewhere a textbox to display the contents of this variable. But because the first character is allways hex(00) it always shows me an empty string.
I want to pass the complete string of 7 bytes to a piece of code which will read the textdata from the referenced file.
Peter van Collenburg
peter@plamirel.nl
Al Smith
Dec 11th, 1999, 08:00 AM
Hi,
I'm not sure what your trying to do but, having worked with hex numbers in the past, this might help. I'm guessing that from the hex string you supplied (00 4b 00 25 c9 00 00) that the file is 75 bytes in length with a starting point of 51493. 004b being the length and c925 being the starting point.
The formula to convert 8 bit (1 byte) to 16 bit numbers is ((byte1 * 256) + byte2).
Al.
------------------
A computer is a tool, not a toy.
Peter van Collenburg
Dec 11th, 1999, 02:03 PM
Hi Al,
In my database there is on every record another the start and length pointer into the reference file, they are infact parameters into a large memofile.
What I want to do is to get somehow in VB this complete string of 7 bytes, including the hex(00) byte, and pass it to a function which will read the memofile.
At the moment VB thinks that my string is empty due to the hex(00) byte.
Must I directly pass the database field context to the translate / read function?
If so do you have a kind of example?
Regards, Peter van Collenburg
Al Smith
Dec 12th, 1999, 02:13 AM
Hi,
Maybe you can get an idea from this.
Here's a sub I threw together that creates a string of hexadecimal numbers then reads this string and returns the raw string, the hex values in the string and the decimal values in the string.
The hex 00 at the beginning of the string didn't affect it.
Al.
Sub Main()
strHex = Chr(&H0) & Chr(&H4B) & Chr(&H0) & Chr(&H25) & Chr(&HC9) & Chr(&H0) & Chr(&H0) 'Creates a string of hexadecimal numbers
For x = 1 To Len(strHex)
strHexadecimal = strHexadecimal & Hex(Asc(Mid(strHex, x, 1))) 'Reads the hex string and returns hexadecimal
strDecimal = strDecimal & Str(Asc(Mid(strHex, x, 1))) 'Reads the hex string and returns decimal
Next x
Debug.Print strHex 'Prints the raw hex string
Debug.Print strHexadecimal 'Prints the returned hexadecimal string
Debug.Print strDecimal 'Prints the returned decimal string
End Sub
------------------
A computer is a tool, not a toy.
Gerald
Dec 12th, 1999, 06:07 AM
Peter,
I had a similar problem with an old xBase database (developed using Clipper) that used a product called Flexfile as a replacement for the memo field data type. The pointer to the memo text was stored in a 6 byte field of string (character) data type. When I attempted to work with this database using Visual Basic, I ran into the same problem that you did. However, because the database was to be converted to MS Access, I didn't give much thought to the problem. All I needed to do was convert the memo file and tables over to a format that could be imported into MS Access--namely Foxpro dbf/fpt files. Is conversion to another database an option for you?
Sorry I couldn't be of more help,
Gerald M.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.