How to use feof and ferror for fgets (minishell in C)
I've written this minishell but I'm not sure I'm making a correct control of the errors. I know fgets can return feof and ferror ( http://www.manpagez.com/man/3/fgets/ ) but I don't know how to use them. I've checked if fgets returns a null pointer (which indicates the content of the buffer is inditerminate) but i would like to know how to use feof and ferror. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #define LINE_LEN 50 #define MAX_PARTS 50 int main () { char* token; char str[LINE_LEN]; char* arr[MAX_PARTS]; int i,j; bool go_on = true; while (go_on ==