|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File access issueI am writing a program that opens a file and writes to it. When I open the
file to read data from it, I have no problems but when I try and write to it I get an error saying that the file is already in use (System.IO.IOException: The process cannot access the file "O:\2006-04-25\2006-04-25.mpg" because it is being used by another process.). As you can see the file is an mpeg file which are often very large so I would rather not make a copy of the file to avoid the problem. I used "Process Explorer" and found that Windows Explorer is locking my mpeg files any time they are opened and will not release them unless the process is killed and then started again. In Process Explorer there is an option to close the handle which fixes the problem. Can anyone tell me how to add this into my program so that if I run into this problem, I can simply close the handle and try again? Thanks in advance for your help. -Jason Jason,
Have a look at this simple tip on our website http://www.vb-tips.com/default.aspx?ID=ab51796e-f392-4c92-8759-d436c3b242c1 I hope this helps, Cor Show quoteHide quote "Jason" <jshic***@comcast.net> schreef in bericht news:GpmdnczrZ5xyJ8PZnZ2dnUVZ_vSdnZ2d@comcast.com... >I am writing a program that opens a file and writes to it. When I open the >file to read data from it, I have no problems but when I try and write to >it I get an error saying that the file is already in use >(System.IO.IOException: The process cannot access the file >"O:\2006-04-25\2006-04-25.mpg" because it is being used by another >process.). As you can see the file is an mpeg file which are often very >large so I would rather not make a copy of the file to avoid the problem. >I used "Process Explorer" and found that Windows Explorer is locking my >mpeg files any time they are opened and will not release them unless the >process is killed and then started again. In Process Explorer there is an >option to close the handle which fixes the problem. Can anyone tell me how >to add this into my program so that if I run into this problem, I can >simply close the handle and try again? Thanks in advance for your >lp. -Jason > Thanks for the reply but I am actually needing to write to the file as I am
patching the header. I need to open it with write access. Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23QyGfLmcGHA.3364@TK2MSFTNGP05.phx.gbl... > Jason, > > Have a look at this simple tip on our website > > http://www.vb-tips.com/default.aspx?ID=ab51796e-f392-4c92-8759-d436c3b242c1 > > I hope this helps, > > Cor > > "Jason" <jshic***@comcast.net> schreef in bericht > news:GpmdnczrZ5xyJ8PZnZ2dnUVZ_vSdnZ2d@comcast.com... >>I am writing a program that opens a file and writes to it. When I open >>the file to read data from it, I have no problems but when I try and write >>to it I get an error saying that the file is already in use >>(System.IO.IOException: The process cannot access the file >>"O:\2006-04-25\2006-04-25.mpg" because it is being used by another >>process.). As you can see the file is an mpeg file which are often very >>large so I would rather not make a copy of the file to avoid the problem. >>I used "Process Explorer" and found that Windows Explorer is locking my >>mpeg files any time they are opened and will not release them unless the >>process is killed and then started again. In Process Explorer there is an >>option to close the handle which fixes the problem. Can anyone tell me >>how to add this into my program so that if I run into this problem, I can >>simply close the handle and try again? Thanks in advance for your >>. -Jason >> > >
Count Instances Of String Within String
Large text file import: MVP question Accessing SQL dataset value from button Removing array entry so cumbersome?? Declaring a garbage collector Regex references NULL Value - Specified cast is not valid array operators Beginner- 2 Forms & Events Using Streamreader with files in servers |
|||||||||||||||||||||||