Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: s/puts/fputs/; in code examples

...

This noncompliant code example calls putsfputs() and fails to check whether a write error occurs:

Code Block
bgColor#ffcccc
langc
putsFILE* f = /* output file stream */
/* ... */
fputs("foo", f);

However, putsfputs() can fail and return EOF.

...

Code Block
bgColor#ccccff
langc
FILE* f = /* output file stream */
/* ... */
if (putsfputs("foo", f) == EOF) {
  /* Handle error */
}

...