binary files

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi justforfunman,

that depends on the format of the files !!!

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

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


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
justforfunmanAuthor Commented:
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.


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.

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

>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.
justforfunmanAuthor Commented:
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.
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.

justforfunmanAuthor Commented:
Unfortunately, there is nothing that I can read from the file.
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?

justforfunmanAuthor Commented:
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??

Every file can be viewed with a hex editor.
Just try one like:

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

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.

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


open them in a hex editor and try to see if you can make sense.
justforfunmanAuthor Commented:
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.

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.

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.
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

if you want to edit someone's data files make sure leagally you are allowed.
justforfunmanAuthor Commented:
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!!

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.