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.
jwenting
duckman
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337