Hello everyone,
I was trying this very simple piece of code on my Linux machine (running ubuntu 9.10)
When I run this program and inputCode:#include <stdio.h> int main(void){ char c; while((c=getchar())!=EOF) putchar(c); return 0; }
test<CTRL+D>
i get the my input back
testtest
how is this possible ? The input is buffered, meaning that input should be available to the function after pressing enter ENTER button
Also after running the program and by just pressing <CTRL+D> the program is exiting. Shouldn't it exit after pressing the enter button? Because it is after pressing the enter key the input will be read by the getchar() ?
Thank you