...
Code Block | ||
---|---|---|
| ||
FILE* fptr = fopen(file_name, "rb"); fpos_t pos; if (fptr == NULL) { /* Handle Error */ } /* Read data */ if (fgetpos(fptr, &pos)) { /* Handle Error */ } /* Read the data that will be "pushed back" */ if (fsetpos(fptr, &pos)) { /* Handle Error */ } /* Continue on */ |
When using {{Remember to always call Wiki Markup fgetpos()
}} and {{ before fsetpos()
}} it important to keep in mind \[[ (see FIO44-C. Only use values for fsetpos() that are returned from fgetpos())]\].
Risk Assessment
If used improperly, ungetc()
can cause data to be truncated or lost.
...