Subscribe via RSS ... Subscribe via e-mail ... Follow me on Twitter ... Follow me on Facebook ...




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using System.IO;
 
namespace FileHandling
{
  public class FileHandling
  {
    static void Main(string[] Args)
    {
      FileStream lFStream;
      StreamReader lStrReader;
      string lLine = "";
      int lCounter = 0;
      Console.WriteLine("test.txt");
 
 
      try
      {
        lFStream = new FileStream("test.txt", FileMode.Open);
        lStrReader = new StreamReader(lFStream);
 
        while ((lLine = lStrReader.ReadLine()) != null)
        {
          Console.WriteLine("{0}: {1}", lCounter, lLine);
          lCounter++;
        } 
      }
      catch (Exception e)
      {
        Console.WriteLine("Exception : {0}", e);
      }
    }
  }
}


Leave a comment


But please respect the commenting rules. Critizism is appreciated and also general comments of course. If you're rude, I have to delete your comment. Also use your personal/nick name but avoid using business names. Have fun and thanks for participating the discussion.