Two threads reading from same file?
- From: noleander <noleander@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 21:29:01 -0700
I've got a Visual C++ application. It has two threads. Each thread needs
to read from the same data file (no writing is necessary).
No matter what I try, it appears that the two threads interfere with each
other's seek pointer. The reads succeed, but they are reading from the wrong
place in the file. Clearly, the seek pointers are getting altered by the
I must be opening the files wrong. I've tried (in each thread):
_open() followed by call to fdopen()
_sopen() followed by fdoen()
Question: What is the proper way to open a single file from two (or more)
threads so that each thread can read from the file simultaneously?