Link to home
Start Free TrialLog in
Avatar of baiko
baiko

asked on

.DBC file format

I want to make a program(in delphi) that reads from a .DBC I know all the files, field-types so my program is specific for this database. I couldn't find anywere on the web a good referecence to the .DBC file format so I can complete my program.

By file format I mean the HOLE map of the file, what is every byte in the file. Because I know the fields, I am not interested in the headers, just the size of the headers so I know how many bytes I skip. I am VERY interested how the data(records) are positioned in the file so I can read them properly.

Could anyone help me?
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

the DBF file format is the same as DBF

all FoxPro extentions are based on DBF file format

while using ODBC, a DBF is a freetable whereas DBC is a database of free DBF tables.
Avatar of cbasoz
cbasoz

As Captain said DBF and DBC file formats are same (header wise) - a dbc has char 0 for the 263 bytes backlink info.

As I can understand you don't want to know header details but just to know how to read data records, right ?

Easy way is to open the dbc via ODBC or OLEDB and query.

If you want to do it lowlevel :
Read bytes at offsett 8-9. It's a short integer pointing to first data record position. Each data record starts with a delete mark (0x20 if not deleted) and length is recsize (read bytes at offsett 10-11 to find record length).
To read the memo fields however you would need to decode 4 bytes for the field content - those 4 bytes is a pointer to memory block (default block is 64 bytes and actual data is in .dct).
 
 
Avatar of baiko

ASKER

cbasoz
i will giive you the points if you give a complete map of the records, just chars and numbers, there are no memos.

10x
ASKER CERTIFIED SOLUTION
Avatar of Cyril Joudieh
Cyril Joudieh
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excuse me for my ignorance but what would you do by reading a DBC ? Curiosity :)
Avatar of baiko

ASKER

I have to do a comercial program in delphi and I do not want to use 3rd party components.
3rd party ? ODBC are OLEDB drivers are not actually be accepted in that category. They're publicly available.
Avatar of baiko

ASKER

Yes, but that would mean I have to bother the user with instaling drivers, no? As I think I said, the aplication has to be independent.

10x for your interest.
I thought you could install drivers during app's install process in Delphi too. Anyways if that's what you want :)