diff options
author | | 1970-01-01 00:00:00 +0000 |
---|---|---|
committer | | 2025-01-08 04:13:03 +0000 |
commit | 06df5a53ff95482a01ee839843c3b3222ddb51e7 (patch) | |
tree | 6c076b931eaa60d60d5a1ec5891aa0cd0c766be8 | |
parent | hello in 1 line (diff) | |
download | cs-06df5a53ff95482a01ee839843c3b3222ddb51e7.tar cs-06df5a53ff95482a01ee839843c3b3222ddb51e7.tar.gz cs-06df5a53ff95482a01ee839843c3b3222ddb51e7.tar.bz2 cs-06df5a53ff95482a01ee839843c3b3222ddb51e7.tar.xz cs-06df5a53ff95482a01ee839843c3b3222ddb51e7.zip |
read/write
-rw-r--r-- | read_write/Program.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/read_write/Program.cs b/read_write/Program.cs new file mode 100644 index 0000000..973e776 --- /dev/null +++ b/read_write/Program.cs @@ -0,0 +1,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); |