以读写文件的方式啊,给你一个DBF文件格式吧。
dbf file structure
i am enclosing a more accurate file layout. note it include
dbaseiii+, dbaseiv, foxbase, foxpro upto and including 2.6.
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 - 0x8e
01-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 0x00
15 encryption flag, encrypted 0x01 else 0x00
changing the flag does not encrypt or decrypt the records
16-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 - 0x0d
field 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 0x00
field 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 addition
note all dbf field records begin with a deleted flag field.
if record is deleted - 0x2a (asterisk) else 0x20 (space)
end of file is marked with 0x1a