March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.IO;
using System.Text;
namespace Samples
{
public class TextReaderSample
{
public static void Main()
{
string s = "textreader.txt";
using(TextReader tr = new StreamReader(s))
{
Console.WriteLine(tr.ReadLine());
Console.WriteLine((Char)tr.Peek());
char[] chars = new Char[4];
tr.Read(chars, 0, chars.Length);
foreach(char c in chars)
Console.Write(c);
Console.WriteLine(tr.ReadToEnd());
}
}
}
}
Hello world! G Goodbye world!
Read now
Unlock full access