Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Intercept file write operations

Intercept file write operations

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Craster
    wrote on last edited by
    #1

    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.

    L 1 Reply Last reply
    0
    • C Craster

      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.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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


      C 1 Reply Last reply
      0
      • L Luc Pattyn

        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


        C Offline
        C Offline
        Craster
        wrote on last edited by
        #3

        Unfortunately I'm looking at being able to run up to 100s of instances simultaneously, so that's just not practical. Thanks, though.

        L 1 Reply Last reply
        0
        • C Craster

          Unfortunately I'm looking at being able to run up to 100s of instances simultaneously, so that's just not practical. Thanks, though.

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          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


          C 1 Reply Last reply
          0
          • L Luc Pattyn

            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


            C Offline
            C Offline
            Craster
            wrote on last edited by
            #5

            Ooh - I'll look into that, thanks.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups