isha iman
how to read data and write data in a text file?
By isha iman in C# on Jun 26 2013
  • Salman  Mushtaq
    Dec, 2013 15

    For reading and writing data you use different byte stream as well as character stream . Mostly developer recommand character stream , First of all include namespace using System.IO; Reading: FileStream fs = new FileStream("FileName.txt" , FileMode.Open); StreamReader sr = new StreamReader(fs); string s; while((s=sr.ReadLine()) != null) { Console.ReadLine(s); } sr.Close(); fs.Close(); ...................... Writing FileStream f = new FileStream("FileName.txt" , FileMode.Create); StreamWriter sw = new StreamWriter(f); sw.WriteLine("String"); // You can write lines as you can s.Close(); f.Close();

    • 0
  • Arjun Dhilod
    Aug, 2013 14

    pls check my blog :-http://arjunwalmiki.blogspot.in/ data-read from comport and save it in txt file and below same my friend also mentioned some comment might be some helpful for you.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS