Ubuntu: Understand format of the parameters in binary file [closed]



Question:

I have a binary file which in it there are some parameters stored as binary, for example : x , y , z , u ,p1 , p2 ,.. up to 12 parameters.

I used "Ghex" to show it, Ghex shows some hexadecimal values but I cannot understand the format of the file(how these parameters have been saved).

Is there any way(program , ...) to understand how these parameters have been saved?


Solution:1

Read man od. od will let you specify any format you like. For instance, if your file is 4byte integers, you'd use od --format=dI.

It depends on what type of variables the "up to 12 parameters" are, and how much space (how many bytes) they take up in the file, and the "endian-ness" of the data (is a 4 byte integer stored as 4321 or 1234 in the file?).

If the file is too complex for od, you could look at Perl's unpack function, with perldoc -f unpack, or the Python struct module.

The real way to understand the format is to look at the program that created the file, or the documentation, or ...., track down the programmer and inquire.

Thanks to @steeldriver


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »