Working WIth Files

  • Thread starter Thread starter Tiraman
  • Start date Start date
T

Tiraman

Hi ,

I m Using The File.CreateText(sFilePath) Function And From Time To Time I m
Getting This Error

The process cannot access the file "c:\Temp\Test.txt" because it is being
used by another process

and after refresh every thing ok and after one more refresh i m getting the
error once again and so on .

what i m missing ?

Best Regards ,

Tiraman :-)
 
* "Tiraman said:
I m Using The File.CreateText(sFilePath) Function And From Time To Time I m
Getting This Error

The process cannot access the file "c:\Temp\Test.txt" because it is being
used by another process

and after refresh every thing ok and after one more refresh i m getting the
error once again and so on .

Create the file using 'System.IO.StreamWriter' directly. If this
doesn't help, turn off all virus scanners and try again.
 
Hi Tiraman,

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that when you use the File.CreateFile
and then write to the file, you got the error message "file ... is being
used by another process error".
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I agree with Herfried's suggestion. In addition, I think you may also try
to use the FileMon tool to monitor the specified the file created by
File.CreateFile to see what process is access the specified file.


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello Peter
10x for your answer , i will try to implement the Herfried idea and i will
use the FileMon Tool .

bye
 
Back
Top