Representing EOF in C code?

后端 未结 10 584
夕颜
夕颜 2020-11-29 00:24

The newline character is represented by \"\\n\" in C code. Is there an equivalent for the end-of-file (EOF) character?

10条回答
  •  死守一世寂寞
    2020-11-29 01:08

    The answer is NO, but...

    You may confused because of the behavior of fgets()

    From http://www.cplusplus.com/reference/cstdio/fgets/ :

    Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or the end-of-file is reached, whichever happens first.

提交回复
热议问题