Saturday, October 21, 2017

Reading Data form Notepad using File InputOutput


                    FileStream fs1 = new FileStream(@"c:\file.txt", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    StreamReader sr = new StreamReader(fs1);
               
          String      str = sr.ReadLine();
             int   a1 = int.Parse(str);

           String     str1 = sr.ReadLine();
            int    a2 = int.Parse(str1);




   string[] n = Regex.Split(s, "\n");//here we are spliting the string based on new line into a array
                                    if (n.Length > LINES) //here LINES is Index no.
                                    {
                                      

                                        for (int i = LINES; i < n.Length; i++)
                                        {

                                            string S1;
                                            S1 = n[i];

                                            if (S1 != "")
                                            {
                                                LINES++;



}

}

No comments:

Post a Comment