using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main() { byte b1 = 10; byte b2 = 0; FileStream f1; FileStream f2; f1 = new FileStream("abc.txt", FileMode.Create, FileAccess.Write); f1.WriteByte(b1); f1.Close(); f2 = new FileStream("abc.txt", FileMode.Open, FileAccess.Read); b2 = (byte)f2.ReadByte(); Console.WriteLine("Val : " + b2); f2.Close(); } } }
Output
Val : 10
In above program, we need to remember, when we use "FileStream" class then we need to include System.IO namespace in the program.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output
In above program, we need to remember, when we use "FileStream" class then we need to include System.IO namespace in the program.