If either the C Standard fgets() or fgetws() function fails, the contents of the array it was writing to are indeterminate. (See also see undefined behavior 170 in Annex J of the C Standard.) Consequently, it It is necessary to reset the string to a known value to avoid possible errors on subsequent string manipulation functions.The fgetws() function is similarly affected.
Noncompliant Code Example
...