K
Kevien Lee
Hi ,
I had a strang problam ,when i use StreamWriter to append to a file,i
found that if i don't close the
StreamReader it couldn't write the data into file,the code as folllow
that:
class Program
{
static void Main(string[] args)
{
FileInfo file = new FileInfo(@"E:\Demo\Log\20061214.log");
StreamWriter debugWriter = new
StreamWriter(file.Open(FileMode.Append, FileAccess.Write,
FileShare.ReadWrite));
debugWriter.Write("dasdasdasdsadsadsadasdasd123354856");
debugWriter.Close();
}
}
however,if remove the debugWriter.Close(),the problam show,why ?can
anyone help me?
Thanks
I had a strang problam ,when i use StreamWriter to append to a file,i
found that if i don't close the
StreamReader it couldn't write the data into file,the code as folllow
that:
class Program
{
static void Main(string[] args)
{
FileInfo file = new FileInfo(@"E:\Demo\Log\20061214.log");
StreamWriter debugWriter = new
StreamWriter(file.Open(FileMode.Append, FileAccess.Write,
FileShare.ReadWrite));
debugWriter.Write("dasdasdasdsadsadsadasdasd123354856");
debugWriter.Close();
}
}
however,if remove the debugWriter.Close(),the problam show,why ?can
anyone help me?
Thanks