Results 1 to 4 of 4

Thread: How to open a file in use?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2009
    Posts
    258

    Question How to open a file in use?

    Okay, I have a program that processes a lot of data, running for 4-5 hours and creating a log file. I want to write a second program to scan the log file while it is being created. I know this should be possible, because I can double-click on the log file (in windows explorer) while the program is running and view the log file using notepad. When I try to open the file via code, however, it tells me the file is in use.

    The process cannot access the file '[filename]' because it is being used by another process.

    The log file is opened by the application, the stream is flushed after each line is written, and the file is closed when the application terminates.

    I tried opening it using a StreamReader from the second application, and it won't let me open it. Any ideas how I can get around this?

    Since I can open the logfile as it is being created with Notepad, it should be possible. All I want to do is read from it, not write to it...
    Last edited by HongKongCV; Nov 2nd, 2011 at 02:13 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width