Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: check fgets return in non-compliant solution

...

Code Block
bgColor#FFCCCC
char buf[BUFSIZ + 1];

if (fgets(buf, sizeof(buf), fp); == NULL) {
  /* handle error */
}
buf[strlen(buf) - 1] = '\0';

...