...
| Code Block | ||
|---|---|---|
| ||
char buf[BUFSIZ];
FILE *file;
/* Initialize file */
if (fgets(buf, sizeof(buf), file) == NULL) {
/* set error flag and continue */
}
|
However, buf is not reset , and will have has unknown contents.
Compliant Solution
...
| Wiki Markup |
|---|
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.19.7.2, "The {{fgets}} function" and Section 7.24.3.2, "the{{fgetws}} function" |
...
09. Input Output (FIO) FIO41-C. Do not call getc() or putc() with stream arguments that have side effects