B
Baskar RajaSekharan
Hi
Plase let me know how to erase filecontent in C-Sharp with some sample
code.
Regards,
R.Baskar
Plase let me know how to erase filecontent in C-Sharp with some sample
code.
Regards,
R.Baskar
Plase let me know how to erase filecontent in C-Sharp with some sample
code.
Baskar RajaSekharan said:Thanks for the solution.
But my problem is slightly different. I forgot to mention about this. The
file is opened is shared mode. It is being used by some other user.
I have to clear the shared file.
This is code I am using.
string sLogFile = @"C:\TimerLog.txt";
FileStream fWriteStream;
if (!File.Exists (sLogFile)) return;
fWriteStream = File.Open(sLogFile,FileMode.OpenOrCreate,
FileAccess.Write ,FileShare.ReadWrite);
StreamWriter sFileWriter = new StreamWriter (fWriteStream);
sFileWriter.Write ("");
sFileWriter.Close ();
fWriteStream.Close ();
code?This does not clear the file.Pls tell me what is the problem in this