0

I want to take backup of a file once it reaches a particular size. The file is associated with stdout stream for multiple process.

I doubt if freopen can be used in this case as it is associated with multiple process.

Though it may succeed with the process which executing that, other process references for stdout going to NULL on UNIX platform. I don't know how it behave on windows.

Renaming that file also not allowing on windows as multiple process are opened that file.

Is there any way to forcefully rename of the file.? On Unix, if I move the file all the process are referring the moved file. This also fine, later I have a mechanism to inform other process to reopen the file.

How to achieve this on windows with C programming.

Venkat
  • 1
  • it looks like you have control over the programs that open the file. Make the programs cooperate, i.e. release the file , wait for backup, reopen the file. – bolov Apr 16 '15 at 13:27
  • possible duplicate of [How to copy "in use" files through batch file in Windows 7](http://stackoverflow.com/questions/7647701/how-to-copy-in-use-files-through-batch-file-in-windows-7) – mfro Apr 16 '15 at 13:30
  • Renaming a file requires `Delete` access in order to unlink it from the directory. Thus all references to the file have to share delete access, per `dwShareMode` of [`CreateFile`](https://msdn.microsoft.com/en-us/library/aa363858). – Eryk Sun Apr 16 '15 at 17:26

0 Answers0