title: What's the easiest way to convert from binary file to a C integer?
body: <p>I have a binary file which contains 4 bytes representing an integer number. I want to read this value and store it into an <code>int</code> variable in C. Is it possible? </p>
  
  <p>The number that I have is <code>176</code> which is written like this <code>...°</code> into the binary file, and if I take the hexadecimal it is <code>0x00 0x00 0x00 0xb0</code> and that is fine. </p>
  
  <p>But I need to get the <code>176</code> into an <code>int</code> variable in C. I hope that I made myself clear.</p>
  
  <p>Thank you!</p>
  
  <p>UPDATE:
  I read the file into a <code>uint8_t</code> array.
  So now I have <code>uint8_t* my_value</code> containing the 4 bytes that I read.
  If I write</p>
  
  <pre><code>int hvalue = my_value[3];
  </code></pre>
  
  <p>I get <code>176</code>, and it works fine but it looks like it's not a good thing to do (because this is a lucky case where <code>176</code> stays in the 1 byte, but if I have a bigger number that needs 2 or 3 bytes this is not going to work anymore)..
  I'm sorry but I have troubles explaining myself...</p>