dbf file structure ~~~~~~~~~~~~~~~~~~bytes description 00 foxbase+, foxpro, dbaseiii+, dbaseiv, no memo - 0x03 foxbase+, dbaseiii+ with memo - 0x83 foxpro with memo - 0xf5 dbaseiv with memo - 0x8b dbaseiv with sql table - 0x8e01-03 last update, format yyyymmdd **correction: it is yymmdd** 04-07 number of records in file (32-bit number) 08-09 number of bytes in header (16-bit number) 10-11 number of bytes in record (16-bit number) 12-13 reserved, fill with 0x00 14 dbaseiv flag, incomplete transaction begin transaction sets it to 0x01 end transaction or rollback reset it to 0x0015 encryption flag, encrypted 0x01 else 0x00 changing the flag does not encrypt or decrypt the records16-27 dbaseiv multi-user environment use 28 production index exists - 0x01 else 0x00 29 dbaseiv language driver id 30-31 reserved fill with 0x00 32-n field descriptor array n+1 header record terminator - 0x0dfield descriptor array table bytes description 0-10 field name ascii padded with 0x00 11 field type identifier (see table) 12-15 displacement of field in record 16 field length in bytes 17 field decimal places 18-19 reserved 20 dbaseiv work area id 21-30 reserved 31 field is part of production index - 0x01 else 0x00field identifier table ascii description c character d date, format yyyymmdd f floating point g general - foxpro addition l logical, t:t,f:f,y:y,n:n,?-not initialized m memo (stored as 10 digits representing the dbt block number) n numeric p picture - foxpro additionnote all dbf field records begin with a deleted flag field. if record is deleted - 0x2a (asterisk) else 0x20 (space) end of file is ed with 0x1a
与我读出的数据对不上号,这已是我第二次提问了。你若熟悉,请帮我较为详细的解读一下。
我读出的DBF数据如下(按字节序):
48 2 4 16 97 0 0 0 63 45 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 122 0 0 后面是字段说明,对得上号
这是一个有4个字段 97条记录的DBF文件头,记录长=45
(1)数据中的48、63、45、122表示什么?
(2)如何从中得到字段数、文件头长度?
非常感激!
http://www.csdn.net/Dev/Format/#数据库文件格式
有DBF的文件结构资料
你自己看看吧
~~~~~~~~~~~~~~~~~~bytes description
00 foxbase+, foxpro, dbaseiii+, dbaseiv, no memo - 0x03
foxbase+, dbaseiii+ with memo - 0x83
foxpro with memo - 0xf5
dbaseiv with memo - 0x8b
dbaseiv with sql table - 0x8e01-03 last update, format yyyymmdd **correction: it is yymmdd**
04-07 number of records in file (32-bit number)
08-09 number of bytes in header (16-bit number)
10-11 number of bytes in record (16-bit number)
12-13 reserved, fill with 0x00
14 dbaseiv flag, incomplete transaction
begin transaction sets it to 0x01
end transaction or rollback reset it to 0x0015 encryption flag, encrypted 0x01 else 0x00
changing the flag does not encrypt or decrypt the records16-27 dbaseiv multi-user environment use
28 production index exists - 0x01 else 0x00
29 dbaseiv language driver id
30-31 reserved fill with 0x00
32-n field descriptor array
n+1 header record terminator - 0x0dfield descriptor array table
bytes description
0-10 field name ascii padded with 0x00
11 field type identifier (see table)
12-15 displacement of field in record
16 field length in bytes
17 field decimal places
18-19 reserved
20 dbaseiv work area id
21-30 reserved
31 field is part of production index - 0x01 else 0x00field identifier table
ascii description
c character
d date, format yyyymmdd
f floating point
g general - foxpro addition
l logical, t:t,f:f,y:y,n:n,?-not initialized
m memo (stored as 10 digits representing the dbt block number)
n numeric
p picture - foxpro additionnote all dbf field records begin with a deleted flag field.
if record is deleted - 0x2a (asterisk) else 0x20 (space)
end of file is ed with 0x1a
原因已找到,问题已解决,结贴,买单。