Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added link to FIO39-C in 2nd CCE

...

Code Block
bgColor#ccccff
FILE *fd = fopen(file_name, "w+");
if (fd == NULL) {
  /* Handle Error */
}

/* Write to file */

/* ... */

/* Go to beginning of file */
fseek(fd, 0, SEEK_SET);

/* Read from file */
fclose(fd);
fd = NULL;

Be sure to use fflush() after writing data to the file, in accordance with FIO39-C. Do not alternately input and output from a stream without an intervening flush or positioning call.

Non-Compliant Code Example (owner)

...