Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: include wide-char behavior

...

The fgets function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned.

The wide-character function fgetws() has the same behavior.

Therefore, if fgets() or fgetws() returns  return a non-null pointer, we can assume it actually filled the array with data. However, assuming that it filled the array with a nonempty string is erroneous because the data it placed in the array may contain null characters.

...