I want to make a while loop that is continually asking a user for input until the user ctrl-d\'s out of it. How can I do this correctly? I am using this ri
A ctrl-d will send an EOF (end of file) character, which translates in fgets as a NULL pointer :
EOF
fgets
NULL
while (fgets(user_input, 1000, stdin) != NULL) { // do stuff... } // no more user input