only 1 thread can access the file at once as the file pointer WILL move during the read and write operations.
Say you're reading and have read 100 bytes. Now the other thread moves in and starts to write after setting the file position 1000 bytes from the end.
After 200 bytes the read thread begins again and tries to write 900 bytes.
Not only will it read from the wrong part of the file it will also try to read beyond end of file.
Reputation Points: 1658
Solved Threads: 331
duckman
Offline 7,719 posts
since Nov 2004