This code snippet demonstrates how to read a text file and write text on a console.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace convert_string_to_binery
{
class Program
{
static void Main(string[] args)
{
TextReader tr = File.OpenText(@"E:\c#\ssdd.txt");
Console.WriteLine(tr.ReadToEnd());
tr.Close();
Console.WriteLine(Console.Read());
}
}
}
Josip JuricPosted Sep 23, 2010, 3:26 PM
This is good but TextReader had a better alternative StreamReader and you could dispose TextReader on the end! :)
Fareed NizamiPosted Sep 22, 2010, 2:30 AM
Keep it up , nice ......
Fareed NizamiPosted Sep 22, 2010, 2:29 AM
Nice one article, keep it up
R JPosted Sep 21, 2010, 6:57 AM
hi... how to display the text of text-file into a richtext box in windows application....