Solved

binary files

Posted on 2003-11-15
18
616 Views
Last Modified: 2010-04-17
Hi..
I would like to 'decode' some binary files.
In details: I am currently running some simulations and the results for these simulations are saved as binary files. I could of course read these results if I load them into the simulation program itself but it is not enough. There are much more information that I need to extract from these binary files and I know these information are stored somewhere in the binary files.
Any idea of how can I do this??
It is pretty important.
Thanks.
0
Comment
Question by:justforfunman
  • 6
  • 5
  • 3
  • +2
18 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 30 total points
ID: 9754135
Hi justforfunman,

that depends on the format of the files !!!

e.g. in C, all you need to do is

fopen ();
fread();
/* this is where format comes in ... if you know the format, you can get information here ... extract information*/
fclose();

Cheers!
Sunny:o)
0
 

Author Comment

by:justforfunman
ID: 9754512
The programm is written in MS viual basic 5 and the file should be in vb format as well.
Please give me straight instructions if possible as I have not much programming experience in this.

Thanks

0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 30 total points
ID: 9757241
You need to know the format of the file.  You can open it and read it but without knowing the file format the data will be meaningless.

mlmcc
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9757961
>The programm is written in MS viual basic 5 and the file should be in vb format as well
What is the VB format???

look at it this way ... Everything that is written in your system is just 0 and 1
Then how do we have so many different file format ? Simply because, the way these 0s and 1s are ordered is different in each format... The way information is stored in an excel sheet is different from text in notepad... Until and unless you know this underlying format, you cannot interpret the information held in it.... all you can do is read 0s and 1s and print them meaninglessly

So, give us the file format first.
0
 

Author Comment

by:justforfunman
ID: 9758182
ok guys, sorry for the misunderstanding.
at the moment, i still couldn't figure out the file format. I just know that it is a binary file as the programm said so and no format is stated there. if you guys can be so kind to give me some idea on how to figure this out, i will appreciate it very much. anyway, i will try my best to find it out and post any results here if i am successful.
thanks.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9758480
If they don't publish the format then the only way to find the format is through trial and error.

Run the simuation to create the file and put some known information into the simulation.

Look at the file and see if you can see the information.

Repeat several times to see what changes when you change a single value in the simulation.

mlmcc
0
 

Author Comment

by:justforfunman
ID: 9758700
Unfortunately, there is nothing that I can read from the file.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9758748
Any ideas what the data is supposed to be?

If you run the simulation and print what you can what do you get?  What does the file show?

mlmcc
0
 

Author Comment

by:justforfunman
ID: 9758932
Ok. So it is actually monte carlo simulation which simulates radiation transport.
So, the results file is supposed to store the energy deposited in some voxels (volume elements) and I think each voxel is allocated 8 bytes. This is just a small part from it, besides there are still more information about the energy and direction of each particle. In fact, these all should be numbers. The programm itself can read these and presents these information as some graphs but I need the numerical values. I know these values are somewhere in the file as these values are used to plot the graphs and so on.
So, hope that it is clear.
Any clues??

Thanks
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 54

Assisted Solution

by:nico5038
nico5038 earned 20 total points
ID: 9760103
Every file can be viewed with a hex editor.
Just try one like:
http://linux.tucows.com/preview/8309.html

Finding the values can be tempting as they can be stored as numbers, hexfigures or sometimes even coded...

Nic;o)
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9761371
In your file numbers are stored in binary form not decimal.  If you try to view with say notepad you will see the ASCII representation.
A HEX editor will show you the hex equivalent 2 digits per byte.
Unless you can provide some information on the values you think are stored it will be very difficult to figure out the file format.

mlmcc
0
 
LVL 9

Assisted Solution

by:bhagyesht
bhagyesht earned 20 total points
ID: 9761641
open your files using a binary editor see if you can make any sense of it. if yes its possible to decode them
VC 6.0 is good binary editor

or

open them in a hex editor and try to see if you can make sense.
0
 

Author Comment

by:justforfunman
ID: 9762948
Hi all,
I tried Hex Editor but couldn't figure out much from it. I tried to search for some known values in the Hexfigures but it is not so rewarding.
mlmcc, what kind of values you want me to provide you which you think will help?
Thanks everyone.


0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9763130
I don't know since I am not familiar with the application.  A sample of the file and a sample from the simulation.

Information on several voxels.

mlmcc
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9763210
IMHO, given  a sequence of 0s and 1s, trying to decipher the format of a binary file is not a trivial task... If the format can be learnt from the vendor or such resource, it will be lot more easier for you. Reading the file in a hex editor or or such things is highly unlikely to get you anywhere. It will be a waste of time and resources.
0
 
LVL 54

Expert Comment

by:nico5038
ID: 9765550
You can look to the right hand side of the hex editor to see the characters the hex figures represent.
Not all characters however are printable.
Typed numbers in hex will look like:
30 31 32 etc
But when stored in binary coded format the digits can represent the numbers like:
00 12 34 56
or when real binary from 0 to 16:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 10

Nic;o)
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9768980
if you want to edit someone's data files make sure leagally you are allowed.
0
 

Author Comment

by:justforfunman
ID: 9802217
hi everybody, seem like it is a non-trivial task.
I will try to find out the file format and post again for your help when i got it.
thanks everybody!!


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now