fgets(str, LINE_LEN, stdin);
if (str==NULL) {
goto errorfgets;
}
That's not how you check the return value of fgets
. What's more, in your code str
will never be NULL
by definition. You want something like:
if (!fgets(....)) }
/* error handling. */
}