Read and write db file

Hi, I try to read and write db file use this method

local path = system.pathForFile( “paul.db”, system.DocumentsDirectory )
local path2 = system.pathForFile( “test.db”, system.DocumentsDirectory )

local fh = io.open( path, “r” )
local contents = fh:read( “*a” )

fhs = io.open( path2, “w” )
fhs:write(contents)

io.close( fhs )
io.close(fh)
contents = nil

I can get the structure of database, however the record is not copied into another database.

Does anyone know why ? [import]uid: 159661 topic_id: 31960 reply_id: 331960[/import]

Dont know for sure, but my guess is try opening and writing the new file as binary.

io.open(path,“rb”)

io.open(path,“wb”) [import]uid: 9070 topic_id: 31960 reply_id: 127431[/import]

can you please solve my prob, its here
https://developer.coronalabs.com/forum/2012/10/15/get-object-displaygroup [import]uid: 163563 topic_id: 31960 reply_id: 127433[/import]

Thanks,

It worked [import]uid: 159661 topic_id: 31960 reply_id: 127437[/import]

Dont know for sure, but my guess is try opening and writing the new file as binary.

io.open(path,“rb”)

io.open(path,“wb”) [import]uid: 9070 topic_id: 31960 reply_id: 127431[/import]

can you please solve my prob, its here
https://developer.coronalabs.com/forum/2012/10/15/get-object-displaygroup [import]uid: 163563 topic_id: 31960 reply_id: 127433[/import]

Thanks,

It worked [import]uid: 159661 topic_id: 31960 reply_id: 127437[/import]