联系人数据库格式

lua-users home
wiki

用于检查记录的Plua代码
-- 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基偏移量)

电话标签

每个标签有4位,包含一个数字,指示使用哪个标签:0表示工作,1表示家庭,2表示传真,3表示其他,4表示电子邮件,5表示主要,6表示寻呼机,7表示手机。要读取标签,使用“floor(byte / 16)”获取高位标签,使用“byte - (byte / 16)”获取低位标签。要写入标签,“byte = lower + upper * 16”。

地址标签

每个标签有4位,包含一个数字,指示使用哪个标签:0表示工作,1表示家庭,2表示其他。标签的读写方式与电话标签相同。

即时消息标签

每个标签有4位,包含一个数字,指示使用哪个标签:0表示即时消息,1表示AIM,2表示MSN,3表示Yahoo,4表示AOL ICQ。标签的读写方式与电话标签相同。

上述内容在 [HB++ 社区论坛] 中得到确认


RecentChanges · preferences
编辑 · 历史
最后编辑于2007年10月23日 15:58 GMT (差异)