Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.