We should not read after a write to a file without an intervening call to fflush(), fseek() or rewind()

A) True
B) False

Showing Answers 1 - 7 of 7 Answers

dasam

  • Mar 30th, 2007
 

We cannot read the data using fread() function that was written in to file using fwrite() function. This is so beacause the file pointer (FILE* fp) that was passed as the argument of the fread() function doesnt point to the same address where the fp poitner in fwrite() function points.

The function fflush() forces a write of all buffered data. The fseek() function sets the file position indicator for the stream pointed to by stream.

Before reading the file that was written into output stream we need to call the above two functions for the reason specified.

correct me if i am wrong

  Was this answer useful?  Yes

sunil

  • Mar 1st, 2013
 

A) True

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions