Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Talking Unanswered: Playing with dbf files, headers and c++

    Hi everyone!

    I was wondering, does anyone know of any web-sites where they, in some detail, discuss the opening and editing of a dbf file, preferably in c++, but any other language is fine? I am trying to open and read a dbf file (oddly enough) and am having no end of difficulty in even understanding the file format.

    ie, there are three structures, the table file header (ok, the main header of the file, little difficulty there), the Table Field Descriptor (I take it this is the section where columns are described), the field descriptor array (sorry? What is this used for??) and the database records (I take it, the actual data of the file!). And ideas if this breakdown is correct?

    Finally, when I check my version number, using c++, and this snippet of code

    <snip>
    ifstream inFile("pat.dbf", ios::in|ios::binary);
    unsigned char dBV = 0;
    unsigned long id2 = 0;
    inFile.read(&dBV,1); // byte 0

    id2 = (dBV);
    cout << "Raw value: " << (id2) << endl;

    the result is, on running:
    Raw Value: 48

    Which seems to imply that the version is 0! However, some freeware dbase editors CAN open the file - so which version are they using? Do versions really matter?

    Cheers
    Andrew

    PS I ma assuming the the version is zero as bits 0 - 2 are the version bits, and they are zero in the number 48...

  2. #2
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251

    Re: Playing with dbf files, headers and c++


  3. #3
    Join Date
    Dec 2002
    Posts
    2
    Yeah, it is the docs I have - however, it does not explain the odd numbered version I am getting!

    Thanks tho.

  4. #4
    Join Date
    Jan 2003
    Location
    Sweden
    Posts
    15
    It's not only version numbers. It also indicates which driver is used to create the DBF. Different drivers, like FlexFile, Comix, Foxpro,etc., uses different kind of memo file formats and therefor use thier own descriptor as the first byte. That should prevent for instance dBase to try to open and alter memo fields in a DBF created with FlexFile or Foxpro as dBase don't understand the format of the those Memo files.

    /LG

    Originally posted by AIyer
    Yeah, it is the docs I have - however, it does not explain the odd numbered version I am getting!

    Thanks tho.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •