Can I allow multiple programs to read from the same file at the same time?

后端 未结 1 1872
北荒
北荒 2021-01-12 04:06

I have an application that reads a set of data files and performs some model computations. The program does not need to modify the data files themselves, so I\'m currently

相关标签:
1条回答
  • 2021-01-12 04:15

    If you can change the fopen routine then try to replace fopen calls with _fsopen, for shared reading/writing. _fsopen is mscrt-specific.

    If you can use CreateFile, and don't want to re-write all the legacy code for read/write, you can also try associating a FILE * with a winapi file handle. Use _open_osfhandle to get a file descriptor from a file handle returned by CreateFile, then use _fdopen to get a FILE * from that file descriptor.

    0 讨论(0)
提交回复
热议问题