-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileReadWrite.cs
More file actions
34 lines (30 loc) · 975 Bytes
/
FileReadWrite.cs
File metadata and controls
34 lines (30 loc) · 975 Bytes
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
26
27
28
29
30
31
32
33
34
using System;
using System.IO;
namespace day_1
{
public class FileReadWrite
{
public void read()
{
FileStream f = new FileStream("D:\\dotnet\\day_1\\read.txt" , FileMode.Open);
int i = 0;
while ((i = f.ReadByte()) != -1)
{
Console.Write((char)i);
}
f.Close();
}
public void write()
{
FileStream f = new FileStream("D:\\dotnet\\day_1\\write.txt", FileMode.Open);
Console.WriteLine("Enter your text");
for (int i = 0; i <= 7; i++)
{
char a = Convert.ToChar(Console.ReadLine());
f.WriteByte((byte)a);
}
f.Close();
Console.WriteLine("Go see the file");
}
}
}