Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem reading a dBase file

Status
Not open for further replies.

googoo

Technical User
Nov 29, 2002
3
AU
Hi guys,

I am trying to read a dBase file, using c++. The following snippet of code is used to check the first byte of a dBse file (whose version is unknown):

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 << &quot;Raw value: &quot; << (id2) << endl;

The output of running this is:

Raw Value: 48

This is somewhat conufusing ~ my notes on dBase say that version is stored in the first byte, in bits 0 - 2. However, this seems to indicate that the version is 0! Any ideas, and does version number REALLY make a difference in getting to unravel a dBase file?

Cheers, and merry christmas guys!
Andrew
 
I'm not 100% certain but I don't think it's necessary to know which version the DBF file is to read it like you're doing. The only thing you need to be concerned with is the field structure. There's always a better way...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top