Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- FileStream tmp_file = new FileStream("e:/practice/tmp.txt", FileMode.Create, FileAccess.ReadWrite);
- using(FileStream first_file = new FileStream("e:/practice/first.txt", FileMode.Open, FileAccess.Read))
- {
- int i;
- while ((i = first_file.ReadByte()) != -1)
- tmp_file.WriteByte((byte)i);
- }
- using(FileStream first_file = new FileStream("e:/practice/first.txt", FileMode.Truncate, FileAccess.Write))
- {
- using(FileStream second_file = new FileStream("e:/practice/second.txt", FileMode.Open, FileAccess.Read))
- {
- int i;
- while ((i = second_file.ReadByte()) != -1)
- first_file.WriteByte((byte)i);
- }
- }
- using(FileStream second_file = new FileStream("e:/practice/second.txt", FileMode.Truncate, FileAccess.Write))
- {
- int i;
- while ((i = tmp_file.ReadByte()) != -1)
- second_file.WriteByte((byte)i);
- }
- tmp_file.Close();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement