The process cannot access the file 'D:.txt' because it is being used by another process in c# -
I have a PDF file that I am trying to write and write in a text file by using it in C # . Now I have created this text file and trying to write my PDF values here, but it is giving the following error.
The process 'D: \ 9008028901.txt' Can not be used because it is being used by another process.
Here my code c # .. ..
Public Bull ExtractText (filename, string outFileName in string) {StreamWriter outFile = null; Try {// Create a Reader for the PDF File PDF Reader Reader = New PDF Reader (EnFileName); OutFile = File.CreateText (outFileName); Outfile = New Streamer (Outfile Name, Wrong, SystemText.ed Encoding.Utf 8);
Here my code is being written in the text file, but I am not able to write any of it. My text file is empty Please help me ..
file. Create Text
method A StreamWire
object that opens the file. It has not stopped and then you try to open the file again with the new stream
call and therefore run it in the file in the usage error. To fix this, you first need to close the StreamWriter
; Outfile = file Create Out (OutFileName); OutFile.Close (); Outfile = New Streamer (Outfile Name, Wrong, SystemText.ed Encoding.Utf 8); Altogether, it seems a little useless, it's just StreamWriter
one time outFile = new streamer (outfile, false, System.Text.Encoding.UTF8) will be more efficient in creating;
File.CreateText
method appears to be unnecessary if the file does not exist then streamlighter
will make it
< / Div>
Comments
Post a Comment