Re: EOF location?



Richard wrote:
A single 0x1A (control-Z in ASCII) is used to indicate EOF,

That is only true if the particular program tests specifically for that
character. Any file can have Ctrl-Zs scattered through them and what
happens is entirely dependent on the program.

I carefully noted in the rest of my reply that this is an API convention. I never suggested that the EOF char had to be unique, but the very tools that were used upthread would, in fact, never allow one to "see" the EOF. They use APIs that look for it and consume it.

[...]

similar to EOT in POSIX environments.

Except that EOT is 'End of Transmission' and has no effect of files.

Except for stdin and friends, which are files (or have file semantics) on POSIX systems. Since there is no special character marking EOF on most POSIX systems they are not equivalent. But the chars are used similarly in other regards.
.



Relevant Pages

  • Re: detab utility challenge.
    ... it is possible that some valid character may ... I'd guess the answer is the same, use feof() to verify an eof ... no. Undefined Behaviour is a technical term from the standard. ... Any program written in any language can contain mistakes. ...
    (comp.lang.c)
  • Re: detab utility challenge (wrapping up).
    ... opens up UB is argvcontains over 500 character is unacceptable. ... Another problem is that putchar needs to be tested for EOF on every call, ... but it will only break on pathological implementations or (more ... Mission creep should be seen for what it is, ...
    (comp.lang.c)
  • Re: confused about behaviour of scanf
    ... Scanf also always leaves the terminating char in the input stream, so flushln (barring EOF or error) will always have a '\n' to terminate on. ... They allow overflow detection, ... detect the character that terminated a numerical field. ... Skipblks returns the char that getc will next return, ...
    (comp.lang.c)
  • Re: String to integer
    ... detect the character that terminated a numerical field. ... Skipblks returns the char that getc will next return, or EOF. ... int skipwhite; ...
    (comp.lang.c)
  • Re: Building a simple command line interface
    ... detect the character that terminated a numerical field. ... static int ignoreblks ... which may be \n or EOF ... Skipblks returns the char that getc will next return, ...
    (comp.arch.embedded)