Skip to content
Sign upLog in
← Back to Community

How to trigger EOF from user input dependent program (C programming) ?

Profile icon
JVegaKing07

Hi repl community,

I am not sure how to trigger EOF in the repl IDE. In an other IDE, CodeBlocks, I am able to break out of the loop's condition and trigger EOF by using the keys Enter, followed by ctrl+z, and then the Enter key again. Unfortunately, on the repl IDE these keystrokes do not trigger EOF.

Is there a different key-stroke sequence to trigger EOF in this web-based IDE?

thanks in advance. I added to code that I found in a C programming language book to test.

https://repl.it/@JVegaKing07/File-Copying
https://repl.it/@JVegaKing07/filecopyingcont

Voters
Profile icon
Michael_Nicol
Profile icon
JVegaKing07
Comments
hotnewtop
Profile icon
katnguyen

Typing Control-D in the input should trigger EOF. This works outside of the classroom environment. In the classroom environment, typing Control-D doesn't work for triggering EOF. Any suggestions ?

Profile icon
MocaCDeveloper

EOF will be \0. This is also used to end strings.
Just check if the current character is \0 and if it is then that would be the EOF of whatever you're doing..

Profile icon
JVegaKing07

@targetfanttthat

Thanks for your reply.

I'm still having trouble triggering EOF. Typing the \0 characters into the stream of input does not trigger EOF. When you suggested that I check to see if the current character is \0, I'm thinking you are referring to what I type in the stream.