I'm reading a text file, which starts something like this:
#Software: Microsoft Internet Information Services 6.0
#Version: 1.0
#Date: 2011-01-01 00:04:26
The code is searching for URLs within the document, all of which start with "http".
My problem is that the StreamReader is only reading the first line over and over... here is the code I am having problems with:
string[] filePaths = Directory.GetFiles(@"C:\Inetpub\wwwroot\kitchenerMarket\data\", "*.log");
//this is where the data is stored, and it will read .log files, the type of file all the data is
//next line makes it run for every file
foreach (string fName in filePaths)
{
//goes up each time a new URL is returned to the array full of all the URLs
int urlCount = 0;
using (StreamReader sr = new StreamReader(fName))
{
string line = sr.ReadLine();
//int result = lineLooker(line, "http");
int result = line.IndexOf("http");
if (result >= 0)
{
//rest of the code
}
}
}
I've looked at the variables in debugger, and it seems like it's reading the same line again and again, as the output is always #Software: Microsoft Internet Information Services 6.0. Any and all insight into this problem is welcome.

New Topic/Question
Reply



MultiQuote










|