Dump data from a binary Dataflex database file
Hi!
In this file there is a format description of DataFlex 2.3b .DAT format:
http://www.wotsit.org/download.asp?f=dataflex
Using this information should help me to dump the the data in a binary dat-file from a dataflex database into an ascii text file. I just don't know how to read and convert binary data. Can anyone give me a hint of how to start?
// Mattias
# 1
The link to http://www.wotsit.org/download.asp?f=dataflex does not work, wotsit's does not allow direct links to thire files. Instead go http://www.wotsit.org/ and search for dataflex
there is only one item in the search result.
I found this interesting aricles to tell me about binary reading generally:
http://www.heatonresearch.com/articles/22/page2.html
http://computer.howstuffworks.com/c39.htm
http://www.webopedia.com/TERM/b/big_endian.html
But I am still confused about how to interpet the format description.
Any help would be greatly appreciated !
// Mattias
# 2
This would be a direct link to the def-file
http://mediasrv.ns.ac.yu/extra/fileformat/database/dat/dataflex.txt
Anyhow, I amm working it out now on my own.
I read 8 bit chars. If I need to convert them into number, e.g. the RECORD COUNT field I first go to the 9:th byte in the file. Then read in 4 bytes. Each byte is converted into an integer. The first byte i multiplyed with 1 (256^0) and added to the second multiplyed with 256 (256^1), etc.
It was't that hard acutally, but I have never done it before. Anyone needs futher help on this or wants sample code, just send an e-mail
mattias (AT) freefarm.se
I used perl instead of Java for this task
http://search.cpan.org/~simonw/File-Binary-1.4/lib/File/Binary.pm
But its pretty mutch the same in java using that binaryfile class listed above.
/ Mattias