DBF Files Help ... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DBF Files Help ...

Hi,

I am creating a class using GNU C++ that can handle dBase DBF Files..So everything is good on my PC, but when I uploaded the DBF file to a unix envirnment I am getting strange numbers, for instance rather than 64 bytes for the record length I am having on unix 64*256 bytes, and the header length must be 97 bytes but on unix the value I got is 97*256...and you know w/o the correct values I can't set the file pointer at the exact place to read or write the records, So I would really need your help guys!



P.S. I uploaded the DBF file as binary file.










Comments

  • Seems like a little endian/big endian problem to me. Here's a good explination:

    http://whatis.com/bigendia.htm



    Solution is easy, just write a macro

    #define MOTOROLLA2INTEL(x) (((x)<<8) | ((x)>>8))



    Now after you read the short from DBF -say short size- you do

    size = MOTOROLLA2INTEL(size);



    And everything will work fine.. Hopefully!







    I'm sure there are tons of help to explain what that is over the net

    You see some OS's (including all microsoft's) use the Intel way, and thats to store low order byte first then high order, Motorolla way is to store hight then low. Your C/C++ compiler will use whatever way your current OS is using.



    : Hi,

    : I am creating a class using GNU C++ that can handle dBase DBF Files..So everything is good on my PC, but when I uploaded the DBF file to a unix envirnment I am getting strange numbers, for instance rather than 64 bytes for the record length I am having on unix 64*256 bytes, and the header length must be 97 bytes but on unix the value I got is 97*256...and you know w/o the correct values I can't set the file pointer at the exact place to read or write the records, So I would really need your help guys!

    :

    : P.S. I uploaded the DBF file as binary file.

    :

    :

    :

    :

    :






  • ThanX, the due date for my project is next friday...Now I know what to do





    MtaMIMI2000


Sign In or Register to comment.