http://hackage.haskell.org/packages/archive/binary/0.4.1/doc/html/Data-Binary.htmlDownload and review this haskell source to see what I ended up with. I defined a DatabaseFile type which includes two magic number words (unsigned shorts of 16 bits each) and then populated the fields from the binary file.
http://openbotlist.googlecode.com/svn/trunk/botlistprojects/botspider/spider/tools/misc/dbreader/haskell
instance Binary SpiderDatabase where
put _ = do BinaryPut.putWord16le 0
get = do
magicnumbera <- BinaryGet.getWord16be
magicnumberb <- BinaryGet.getWord16be
return (SpiderDatabase {magicNumberA=magicnumbera,
magicNumberB=magicnumberb
})
No comments:
Post a Comment