I am grabbing some standard input from the user and if the user presses CTRL+D, I want to display an error and terminate the program. I think perhaps my issue may
On Linux, Ctrl + D generates EOF, so you need to check the return value of fgets() every time. When EOF is encountered, fgets() returns a null pointer
EOF
fgets()
if (fgets(buff, 10, stdin) == NULL) print_error();