Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Compliant Solution

Code Block
bgColor#ccccff
(none known)FILE* fptr = fopen(file_name, "rb");
fpos_t pos;

if (fptr == NULL) {
  /* handle error condition */
}

if(fgetpos(fptr, &pos)) {
  /* Handle Error */
}

/* Read data */

if(fsetpos(fptr, &pos)) {
  /* Handle Error */
}

/* Continue on */

Risk Assessment

If used improperly, ungetc() can cause data to be truncated or lost.

...