So I am trying to create a console app to parse text files. I am using a streamreader to read the text in until I reach end of file. The text file I am reading as 22945 lines. Right now I am just trying to read the entire file and write it to another file. The new file ends at line 22926. Does any body have any idea why? Is there a limit to how much data I can read through a streamreader? The code I am using is this:

while(!fs.EndOfStream)
{
     line = fs.ReadLine();
     fw.WriteLine(line);
}

If it's just text, it should not be a problem.
Are you running into any binary characters?

Would something like this also fail?:

File.WriteAllLines(@"c:\science\out.txt", File.ReadAllLines(@"c:\science\data.txt"));

Actually I just discovered that it was not an issue with the stream that was reading but the one that was writeing. I was not flushing it. Now I have that issue solved. Still have a couple of others but I am not at the point of having to ask for help yet. I may be there soon tough!!!!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.