title: Read file into struct
body: <p>I'm trying to read content of a file into a struct.
  The struct looks like this:</p>
  
  <pre><code>    typedef struct{
              unsigned char e_ident[EI_NIDENT] ;
              Elf32_Half e_type;
              Elf32_Half e_machine;
              Elf32_Word e_version;
              Elf32_Addr e_entry;
              Elf32_Off e_phoff;
              Elf32_Off e_shoff;
              Elf32_Word e_flags;
              Elf32_Half e_ehsize;
              Elf32_Half e_phentsize;
              Elf32_Half e_phnum;
              Elf32_Half e_shentsize;
              Elf32_Half e_shnum;
              Elf32_Half e_shstrndx;
      } Elf32_Ehdr;
  extern Elf32_Ehdr elfH;
  </code></pre>
  
  <p>It's basically an ELF header file. So, anyways i want to load content of a file into this structure.</p>
  
  <p>The function looks like this.</p>
  
  <pre><code>Elf32_Ehdr elfH;
  int load(char* fname){
          FILE* file = fopen(fname,"r");
  
          if(NULL == file) return 0;
  
          fread(&amp;elfH, 1, 52, file);
  
          fclose(file);
          return 1;
  }
  </code></pre>
  
  <p>As it seems it's not working correctly. The content of elfH is not as expected.
  What might be the problem?
  Should i </p>