Why is it when I use fprintf(stdin, "%d", 20);
I can't just use scanf and retrieve that value? I am just trying to figure out how writing to different streams works.
Why is it when I use fprintf(stdin, "%d", 20);
I can't just use scanf and retrieve that value? I am just trying to figure out how writing to different streams works.
gcc -lalleg
http://www.ciusa.net/~jrgrant/
fprintf() writes to an output stream.
stdin is an input stream.
Therefore your code has a conflict.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
>I can't just use scanf and retrieve that value?
It doesn't work that way. For now just think of fprintf as writing to the screen (which can't be read from) and scanf as reading from the keyboard (which can't be written to). So using that model, you can't write to the screen with fprintf and then read what you just wrote because the screen isnt an input stream.
-Prelude
My best code is written with the delete key.