Solved

binary files

Posted on 2003-11-15
18
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 101

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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 101

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 101

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

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 101

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Part One of the two-part Q&A series with MalwareTech.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

634 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