C++ : Opening a file in non exclusive mode

后端 未结 5 641
深忆病人
深忆病人 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:47

    Win32 filesystem semantics require that a file you rename not be open (in any mode) at the time you do the rename. You will need to close the file, rename it, and then create the new log file.

    Unix filesystem semantics allow you to rename a file that's open because the filename is just a pointer to the inode.

提交回复
热议问题