Re: Binary Write to DBF file

Tech-Archive recommends: Speed Up your PC by fixing your registry



kohl.mike@xxxxxxxxx wrote:
Problem: Programmically changing the record count in a dbf file

No matter what I test, nothing seems to work. This is just an example
of what I want to do.

In the dbf header there are bytes that indicate how many recorrds are
in the dbf file. for example

record count: 255

How would I convert it to hex where my byte string would = "FF 00 00
00"

if my record count was 6,233 how would I convert that to a hex number
that is spread out into 4 byes?

Leaving aside the usefulness of what you propose, it's simple. The following is air code and does not reflect best practices:

Dim NumRecs&, NewNumRecs&, ValueLocation&
NewNumRecs& = 6233
ValueLocation& = 37 ' the 1-based file offset of your value

Open "whatever.dbf" for binary as #1
Get #1, ValueLocation&, NumRecs&
Put #1, ValueLocation&, NewNumRecs&
Close #1

--

Jim Mack
MicroDexterity Inc
www.microdexterity.com

.