How to interpret the value of a binary field within a file?

I opened a file in Notepad++.
The file has a field titled "Image Size" with a field type of Binary and is located in positions 47 - 50.
When I inspect this field via the VS2010 debugger, the values are as follows.
This field represents "Check Image Size". What would the value for the Image Size be based on the following positional  values within the field?

Position           Values

[46]                   0                    
[47]                   0
[48]                   53
[49]                   8
zimmer9Asked:
Who is Participating?
 
Bob LearnedCommented:
For C#, you can use the BitConverter class.

BitConverter.ToInt32 Method
https://msdn.microsoft.com/en-us/library/system.bitconverter.toint32%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

Example:
 Byte[] bytes1 = { 0xEC, 0x00, 0x00, 0x00 };
      Console.WriteLine("{0}--> 0x{1:X4} ({1:N0})", FormatBytes(bytes1),
                                      BitConverter.ToInt32(bytes1, 0));

Open in new window

0
 
BeartlaoiCommented:
13576 = (53 * 256) + 8
Your complete equation would be
[49] + ([48]*256) + ([47]*65536) + ([46]*16777216)

Most programming languages have a very simple way to get this without the math, just read it as a 32-bit integer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.