Contacts Db Format |
|
-- 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()
Header bytes (Lau-compatible 1-based offset)
Confirmation of the above in [HB++ Community forums]