Sunday, 20 May 2018

Text Reader and Text Writer in C# File Read Write Operation







-------------------------------------------------------------------------------------------------------------

Text WRITER IN C#

-------------------------------------------------------------------------------------------------------------

         

 using (TextWriter wr=File.CreateText(@"C:\Users\salman\Desktop\FILE\textwriter.txt"))

            {



                for (int i = 0; i < 100; i++)

                {

                    wr.WriteLine((i+1)+"SALMAN MASOOD THE CONCEPT ACADEMY.....");

                }







            }

            Console.WriteLine("FILE CREATED SUCCESSFULLY....");


-------------------------------------------------------------------------------------------------------------

Text READER IN C#

-------------------------------------------------------------------------------------------------------------

  using (TextReader tr = File.OpenText(@"C:\Users\salman\Desktop\FILE\textwriter.txt"))

            {

                Console.WriteLine(tr.ReadToEnd());



            }

            Console.ReadLine();

No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...