0

Can anybody say me which input I have to give on terminal to get 0x0804857d saved in the memory. The used function is scanf("%s", array) ic C language.

The problem is that 08 equals to Backspace which is impossible to input or 04 = EOT. I mustn't change the code...

Maybe its impossible, I don't know

Please help me...

user1844505
  • 1,259
  • 2
  • 10
  • 14
  • 1
    feed stdin from outside. don't type. – Karoly Horvath Nov 17 '14 at 16:55
  • Can you redirect terminal to a file? That is, run `program < file` instead of `program`? If yes, I think it's the simplest way. – anatolyg Nov 17 '14 at 16:55
  • Cannot _only_ save 0x0804857 in memory. Using `scanf("%s", array)` will always (given that some input occurred) append a `'\0'`. Suggest posting the `scanf("%s", array)` use and nearby code to better understand the context. – chux - Reinstate Monica Nov 17 '14 at 17:25

1 Answers1

0

You really should not use the scanf function to read binary data. Use read/fread instead.

Eugene Sh.
  • 17,802
  • 8
  • 40
  • 61