EOF in Windows command prompt doesn't terminate input stream

后端 未结 2 765
悲&欢浪女
悲&欢浪女 2020-11-27 07:40

Code:

#include 
#define NEWLINE \'\\n\'
#define SPACE \' \'

int main(void)
{
    int ch;
    int count = 0;

    while((ch = getchar()         


        
2条回答
  •  失恋的感觉
    2020-11-27 08:09

    ^Z is only translated by the console to an EOF signal to the program when it is typed at the start of a line. That's just the way that the Windows console works. There is no "workaround" to this behaviour that I know of.

提交回复
热议问题