problems with corrupt index in a table...

Hello all,

I'm not sure whether or not this is the most appropriate newsgroup for this

I have a program written in Borland C++ 5 that accesses  .dbf tables.  It
happens that sometimes the indecies on the tables become corrupt and the C++
program cannot open the tables, thus causing the whole thing to crash.  I
can manually "open and detach the indecies" from the tables which allows my
program to read in the table and rebuild an index using standard SQL calls.
My main objective is to be able to handle this manual approach with the
program itself and automate the check table, detach index and rebuild index

If there are some sort of libraries or add on functions for Borland C++ that
allows lower level access to dbf tables?

I feel that this is more of a BDE issue rather than a C++ issue so I have
posted it here.