News for hackers. Stuff that matters.
Re:Getting the ^D by shrubble on Sunday April 09, 2023 @09:53PM (#35508372)
The author takes the long way round and misses the point by a little bit.

ANSI C defines EOF, the 2nd edition by Kernighan and Ritchie page 151 states 'getchar returns the next input character each time it is called, or EOF when it encounters end of file. The symbolic constant EOF is defined in <stdio.h>.

The value is typically -1, bit tests should be written in terms of EOF so as to be independent of the specific value.'

Re:Getting the ^D by zabzonk on Sunday April 09, 2023 @10:08PM (#35508462)
perhaps point out that there is no actual EOF in a file in modern operating systems - i bang on about this here: https://latedev.wordpress.com/2012/12/04/all-about-eof/
Re:Getting the ^D by ksherlock on Sunday April 09, 2023 @10:52PM (#35508713)
The discussion is about how terminals and pseudo terminals handle control characters, specifically ^D / EOF / termios.c_cc[VEOF] which is a few layers below getchar(). man stty(1) or termios(5) for more information.
Re:Getting the ^D by AdieuToLogic on Sunday April 09, 2023 @11:47PM (#35508994)
EOF is also used to indicate error(s) in a stream.

Its value is platform dependent. As per the C++ standard[0]:

  It is a macro definition of type int that expands into
  a negative integral constant expression (generally, -1).
0 - https://cplusplus.com/reference/cstdio/EOF/
Re:Getting the ^D by lionkor on Monday April 10, 2023 @12:16AM (#35509125)
please do not use cplusplus.com, use cppreference instead. cplusplus.com often is wrong, out of date, or just missing things.
Re:Getting the ^D by AdieuToLogic on Monday April 10, 2023 @12:36AM (#35509219)
Noted.

Is this particular citation, "wrong, out of date, or just missing things"?

Re:Getting the ^D by lionkor on Monday April 10, 2023 @05:03PM (#35517386)
None of the above for this case, but generally not a good idea to look there. Instead: https://en.cppreference.com/w/c/io