Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 622
  • Last Modified:

binary files

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
justforfunman
Asked:
justforfunman
  • 6
  • 5
  • 3
  • +2
4 Solutions
 
sunnycoderCommented:
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
 
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.

Thanks

0
 
mlmccCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Thanks
0
 
nico5038Commented:
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
 
mlmccCommented:
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
 
bhagyeshtCommented:
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
 
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.


0
 
mlmccCommented:
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
 
sunnycoderCommented:
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
 
nico5038Commented:
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
 
bhagyeshtCommented:
if you want to edit someone's data files make sure leagally you are allowed.
0
 
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!!


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
  • 3
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now