title: Use scanf to take hex instructions input from the user and save them in char. (C)
body: <p>So, I am building a program that should modify a specific number of bytes in a binary. You first input the binary, then the offset from which point you want the hex instructions to be replaced and then the bytes themselves.</p>
  
  <p>Example:
  I load example.exe
  I specify offset <code>0</code> (beginning of the file)
  I specify hex instructions: <code>4D FF 33 FD FE</code>
  The first 5 instructions of the file should be replaced with the ones I provided. I use <code>fwrite</code> to do the modifications and <code>scanf</code> to get the offset and the hex instructions, however, I can't find a way to actually store them as hex. The fwrite actually writes <code>4D FF 33 FD FE</code> as text inside the binary file instead of hex. I assume I save them wrong in the <code>char</code> in the first place. I am new to C, so what I found online didn't really help.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>      scanf("%ld",&amp;offset_ed);//get the offset from the user.
        fseek(f, offset_ed, SEEK_SET);
        printf("Specify HEX bytes to be written to the binary:  ");
        scanf("%s\n", &amp;hexes);
        fwrite (hexes , sizeof(char), sizeof(hexes), f);
        fclose (f);
  </code></pre>
  
  <p>Where hexes is a char hexes;</p>