Sergey,
I need to know database name without opening the table. How this program should be modified to return database name?
Thanks a lot in advance.
>>Nadya -
>>
>>So far, I think you are giving me the best advice. The idea of searching withing the DBF (I would just open it with low-level file i/o and grab the header) and searching for .DBC might do the trick.
>>
>>Thanks!!
>>
>>Regards,
>>AL
>
>Here's a code to check if table is in a dbc or free
>
lnFh1 = FOPEN("orders.dbf")
>* Position of the first data record - 2 bytes
>= FSEEK(lnFh1, 8, 0)
>lcB1 = FREAD(lnFh1,1)
>lcB2 = FREAD(lnFh1,1)
>* Offset to the beginning of the DBC name
>lnOffset = ASC(lcB2) * 256 + ASC(lcB1) - 264 - 1
>= FSEEK(lnFh1, lnOffset, 0)
>* The first byte of DBC name or 0x00 if it's free table
>lcB3 = FREAD(lnFh1, 1)
>IF ASC(lcB3) = 0
> * free table
>ELSE
> * table in dbc
>ENDIF
>= FCLOSE(lnFh1)
>
If it's not broken, fix it until it is.
My Blog