联系人数据库格式 |
|
-- contacts.lua -- number of header bytes before the first field skip = 17 f,n = io.open("db:/ContactsDB-PAdd", "r") -- just look at one specific record, to make things simpler for investigation for i = 1,1 do print("start") -- open the record and get the record length l = f:openrec(i) if not(l == nil) then -- read header s = f:read(skip) print(string.byte(s, 1)) print(string.byte(s, 2)) print(string.byte(s, 3)) print(string.byte(s, 4)) print(string.byte(s, 5)) print(string.byte(s, 6)) print(string.byte(s, 7)) print(string.byte(s, 8)) print(string.byte(s, 9)) print(string.byte(s, 10)) print(string.byte(s, 11)) print(string.byte(s, 12)) print(string.byte(s, 13)) print(string.byte(s, 14)) print(string.byte(s, 15)) print(string.byte(s, 16)) print(string.byte(s, 17)) print("fields") -- read fields in remaining record after header s = f:read(l-skip) -- fields are all nul-terminated ASCII. Get them. -- This fixed string should be replaced with one that contains 1 S for each field in the header t = bin.unpack( "SSSSSSSSSSSSSSSSSSSSS", s) -- There seems to be some other byte information after the fields, at least in some cases. -- No idea currently what that contains. table.foreach(t, print) end f:closerec() end f:close()
头字节(Lau 兼容的 1 基偏移量)
以上内容已在 [HB++ 社区论坛] 中确认。