EOF in gdb compiler

0 votes
asked Nov 20, 2018 by Fabienne Sousa (130 points)
How do I stop input while using:

while ((c = getchar()) != EOF)

if I use CTRL+D or CTRL+Z it just shuts down the output window. Please help, this is urgent, I have an exam soon and I cant practise unless I get this to work!

1 Answer

–1 vote
answered Nov 22, 2018 by Enzo (120 points)

CTRL+D or CTRL+Z doesn't provoke an EOF. It just terminates your terminal, which in turn the kernel knows no more bytes can be read so no data is available in the standard input file descriptor.

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.