K
kartik
I open an fstream in read-only mode, read till the end, then try to
sync() before seeking to position 0 & reading again. But the sync
fails. I discovered that clear()ing the stream before the sync causes
the sync to work. Seeking to position 0 before the sync doesn't seem
to help.
If you look at sync() as simply invalidating the read buffer (isn't
that right?), isn't it illogical for it to fail in this situation?
Besides sync() doesn't flush the write buffer (on a read-write
stream), does it? Similarly, flush() doesn't invalidate the read
buffer, does it?
I'm using g++ 3.3.2 on Mandrake Linux 10; kernel 2.6.
-kartik
sync() before seeking to position 0 & reading again. But the sync
fails. I discovered that clear()ing the stream before the sync causes
the sync to work. Seeking to position 0 before the sync doesn't seem
to help.
If you look at sync() as simply invalidating the read buffer (isn't
that right?), isn't it illogical for it to fail in this situation?
Besides sync() doesn't flush the write buffer (on a read-write
stream), does it? Similarly, flush() doesn't invalidate the read
buffer, does it?
I'm using g++ 3.3.2 on Mandrake Linux 10; kernel 2.6.
-kartik