0
  ; push stdin here
    push MAX_N             ; maximum number of characters to be read 
    push offset string     ;pointer to an array of chars
    call fgets
    add esp,12

I tried to read into "string" variable a line(with spaces too). I can't do that with scanf so i chose instead to use fgets

But, how can i push standard input there ?

Crisan
  • 1
  • 1
  • 5
  • 1
    http://stackoverflow.com/questions/1247989/how-do-you-allow-spaces-to-be-entered-using-scanf seems like gets has the same problem like scanf – Crisan Dec 23 '16 at 10:39
  • 2
    Did you try the obvious `extern stdin` / `push [stdin]`? It should be a global variable with static storage that holds a `FILE*` value. And yes, `push r/m32` can push a memory operand directly. Any time you get stuck in asm, look at compiler output for a function that does what you want. – Peter Cordes Dec 23 '16 at 10:55
  • @PeterCordes That doesn't work everywhere. For example, on FreeBSD the symbol is called `__stdinp`. – fuz Dec 23 '16 at 12:39

0 Answers0