When I redirect a file to stdin
using MyProgram < cl.txt
command from the command line, scanf
s doesn't wait me to press Enter.
But when I use scanf
in my program without doing so, it does block until enter key is pressed.
How exactly does it determine that? Does it keep reading the stream until \n
is encountered? or does it really wait me to press a key?
When I don't write anything and press Enter it doesn't stop blocking either and keeps asking. I'm really confused.