B
Brian
can someone tell me why this doesn't work...I would expect to see line 1a
replace line 01 in the following code:
FileStream fs = new FileStream(@"c:\temp\myfile.txt", FileMode.OpenOrCreate,
FileAccess.ReadWrite, FileShare.None, 8192);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("this is line 01");
sw.WriteLine("this is line 02");
sw.WriteLine("this is line 03");
sw.BaseStream.Position = 0;
sw.WriteLine("this is line 1a");
sw.Close();
sw.Dispose();
If I use the underlying FileStream and encode the strings myself and add the
line terminators I can do it but I want to use the convienence of the
StreamWriter class.
replace line 01 in the following code:
FileStream fs = new FileStream(@"c:\temp\myfile.txt", FileMode.OpenOrCreate,
FileAccess.ReadWrite, FileShare.None, 8192);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("this is line 01");
sw.WriteLine("this is line 02");
sw.WriteLine("this is line 03");
sw.BaseStream.Position = 0;
sw.WriteLine("this is line 1a");
sw.Close();
sw.Dispose();
If I use the underlying FileStream and encode the strings myself and add the
line terminators I can do it but I want to use the convienence of the
StreamWriter class.