|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Fread help, the problem of too depressed We have not encountered fread end of the document without reading it back to the true situation feof
I call ftell problems immediately after admission guideline document, significantly less than the size of paper (size of the actual document is not), and even the end of the document said. . . . Gloomy ah
We have not encountered similar problems, how to solve the country |
If there are two moves a time into another document with a different fp, we may have such a problem
Feof (fp) is a macro itself will not amend fp information to be changed only in the event of actual fp literacy movement.
For example, fp1 = fopen ( "file1", "r");
Fp2 = fopen ( "file1", "a");
//fp1, In a document is opened fp2
While first procedure (!feof (fp1)) (
;
) 4003rd cycle end, the end of the document
Then
Using fprintf (fp2 that. " . . . . ". . . ); 4003rd documents apparently increased the time
But feof (fp1) at this time is true. Because feof () macro is, as long as fp1 not changed and will never change. (Fp1
Change will only operate for a reading and, if read and write operations on the former feof () judgment is not a dead lock? )
If we still hope
While (!feof (fp1)) (
;
) 4003rd forever to read the new data. This is why not recommended feof (), document the reasons for the end of testing.
|
| |