namespace StreamWriterReaderExample
string filePath = @"C:\Users\horva\OneDrive\Desktop\C#\file\europe.txt";
FileStream fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write);
using (StreamWriter streamWriter = new StreamWriter(fileStream))
streamWriter.WriteLine("Russia has population about 145,934,000");
streamWriter.WriteLine("Germany has population about 83,783,000");
streamWriter.WriteLine("Croatia has population about 3,500,000");
Console.WriteLine("europe.txt created");
FileStream fileStream2 = new FileStream(filePath, FileMode.Open, FileAccess.Read);
using (StreamReader streamReader = new StreamReader(fileStream2))
Console.WriteLine("\nFile read. File content is:");
char[] buffer = new char[10];
char_count = streamReader.Read(buffer, 0, buffer.Length);
string s1 = new string(buffer);
} while (char_count > 0);