summary refs log tree commit diff
path: root/read_write/Program.cs
blob: 973e776ffb74b4db8eb7fdd0927dad8cc19faf67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using System.IO;

int check = 0;
string file = "C:/tmp/io.txt";

StreamWriter writer = File.CreateText(file);
for(int i = 1; i <= 50; i++)
{
	writer.WriteLine(i);
}
writer.Close();

StreamReader reader = File.OpenText(file);
string line = reader.ReadLine();
while(line != null)
{
	if(check % 5 == 0)
		Console.Read();
	Console.WriteLine(line);
	line = reader.ReadLine();
	check++;
}
reader.Close();
File.Delete(file);