3

我想在 Windows 操作系统下以共享模式打开文件进行编辑(其他进程也必须有权访问该文件才能写入)。在 Perl 中可以吗?例如,在 WinApi 中,可以在 CreateFile() 函数中指定标志 FILE_SHARE_WRITE。谢谢!

4

1 回答 1

-1

Multiple processes writing to the same file is a bad situation. An example would be a database scenario where a table must be locked by a processes in order to changes to be written to the table reliably. You could write something that does nothing else but listen to the other processes to write to the file.

perlmonks suggest using flock

Here's the link. Hope this helps!

于 2014-01-10T20:14:58.270 回答