Hi I `m trying to grep through file and count number of lines, maximum number of spaces per line, and longest line.

How I can determine "/n" character if i iterate char by char trough given file?

Thanks a lot.

Here is my code that I used for this:

```
    using (StreamReader sr = new StreamReader(p_FileName))
     {

  char currentChar;
  int current_length=0,current_MaximumSpaces=0;
    p_LongestLine=0;
    p_NumOfLines=0;
    p_MaximumSpaces=0;
    while (!sr.EndOfStream){
        currentChar=Convert.ToChar(sr.Read());
        current_length++;
        if(Char.IsWhiteSpace(currentChar) || currentChar==null){
            current_MaximumSpaces++;
        }
        if(currentChar == '\n'){
            p_NumOfLines++;
        }
        if(current_length>p_LongestLine){
            p_LongestLine=current_length;
        }
        if(current_MaximumSpaces>p_MaximumSpaces){
            p_MaximumSpaces=current_MaximumSpaces;
        }
        current_length=0;
        current_MaximumSpaces=0;
    }
    sr.Close();
}

```