I read somewhere that while(fgets(line, sizeof(line), stdin) != NULL)
should read from standard input until you press Ctrl+D which represents EOF
and generates NULL, but my program keeps going even though I press Ctrl+D, anyone have any ideas? everything is appreciated.
Asked
Active
Viewed 720 times
0

Iharob Al Asimi
- 52,653
- 6
- 59
- 97

Frans
- 89
- 3
- 10
-
1windows? use CTRL+Z then. – Jean-François Fabre Sep 04 '17 at 17:33
1 Answers
1
Ctrl+D is not defined as EOF in the C language specification. Ctrl+D is defined at the operating system level. Therefore, you must be on a system on which Ctrl+D has not the behaviour you expect.

Iharob Al Asimi
- 52,653
- 6
- 59
- 97

Alexandre Fenyo
- 4,526
- 1
- 17
- 24
-
thanks! I tried on Linux instead of Windows and now it works as it should! IT was meant to work in Linux so that's what matters anyways! – Frans Sep 04 '17 at 17:49