Intercept file write operations
-
I have a third party executable that I run, which writes its results to a text file. Unfortunately, it writes only to a single file, overwriting itself each time, and locking the file as it writes. As a result, if I run four copies of this simultaneously, for example, only one of those copies will sucessfully write to the log file. Is there some way I could launch the file and intercept its file output operations (bearing in mind I have no knowledge of how it's doing that output), redirecting them to a unique instance of the log file each time it runs? Thanks for any input, and do let me know if the above doesn't clearly explain what it is I am trying to do.
-
I have a third party executable that I run, which writes its results to a text file. Unfortunately, it writes only to a single file, overwriting itself each time, and locking the file as it writes. As a result, if I run four copies of this simultaneously, for example, only one of those copies will sucessfully write to the log file. Is there some way I could launch the file and intercept its file output operations (bearing in mind I have no knowledge of how it's doing that output), redirecting them to a unique instance of the log file each time it runs? Thanks for any input, and do let me know if the above doesn't clearly explain what it is I am trying to do.
Hi, if the log file's path or name somehow depends on the EXE's path or name, you could create copies of the EXE with different paths or names. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, if the log file's path or name somehow depends on the EXE's path or name, you could create copies of the EXE with different paths or names. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Unfortunately I'm looking at being able to run up to 100s of instances simultaneously, so that's just not practical. Thanks, though.
Hi, if the EXE creates the log at a relative position you could programmatically start it with different explicit "current directory" values (use Process and ProcessStartInfo classes).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google
-
Hi, if the EXE creates the log at a relative position you could programmatically start it with different explicit "current directory" values (use Process and ProcessStartInfo classes).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - use PRE tags to preserve formatting when showing multi-line code snippets - before you ask a question here, search CodeProject, then Google