C++ : Opening a file in non exclusive mode

后端 未结 5 642
深忆病人
深忆病人 2021-01-19 02:23

I have to develop an application which parses a log file and sends specific data to a server. It has to run on both Linux and Windows.

The problem appears when I wa

5条回答
  •  终归单人心
    2021-01-19 02:38

    It's not the reading operation that's requiring the exclusive mode, it's the rename, because this is essentially the same as moving the file to a new location.

    I'm not sure but I don't think this can be done. Try copying the file instead, and later delete/replace the old file when it is no longer read.

提交回复
热议问题