The information in this article applies to:
SUMMARYWhen switching from reading to writing data files, it is necessary to make a call to an fsetpos(), fseek(), or rewind() function. If a call to one of these functions is not made, the file pointer may not be updated and the data could be corrupted. It is also necessary to make a call to one of these functions when switching from writing to reading. This is documented on page 275 of the "Microsoft C Optimizing Compiler Run-Time Library Reference" manual, which shipped with version 5.1 of the Microsoft C Compiler. MORE INFORMATIONThe following program attempts to read in the first character of a file and to write it out as the second character: Sample Code #1
The above program fails because there is no fseek, fsetpos, or rewind between the fscanf and fprintf to change the pointer position. The following program performs the desired operation: Sample Code #2
Additional query words:
Keywords : kbCRT kbVC kbVC600 |
Last Reviewed: July 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |