I just wanted to check what do I read from text file using StreamReader class and
I found that It doesn't read a whole file data. Look at this bits:
FileStream fs =
new FileStream("test.txt",FileMode.Open,FileAccess.Read);
FileStream fs1 = new FileStream("test_read.txt",FileMode.OpenOrCreate,FileAccess.Write);
StreamWriter sw = new StreamWriter(fs1);
using (StreamReader sr = new StreamReader(fs))
{
string strTmp;
while(sr.Peek() >= 0)
{
strTmp=sr.ReadLine();
sw.WriteLine(strTmp);
}
This code must give me two identical files, right? But It doesn't. It cuts few lines at the end.
So what is the catch?