C# file merging code

大家讲道理
Release: 2016-11-10 10:18:08
Original
1926 people have browsed it

using System;
using System.IO;
string filetomerge=@"C:\temp\data.bin";
string targetpath=@"D:\store";
string strFileName = filetomerge.Substring(filetomerge.LastIndexOf(Path.DirectorySeparatorChar) + 1);
FileStream fsr1 = new FileStream(targetpath+ Path.DirectorySeparatorChar + strFileName + "1", FileMode.Open, FileAccess.Read);
FileStream fsr2 = new FileStream(targetpath+ Path.DirectorySeparatorChar + strFileName + "2", FileMode.Open, FileAccess.Read);
byte[] btArr = new byte[fsr1.Length+fsr2.Length];
fsr1.Read(btArr, 0, Convert.ToInt32(fsr1.Length));
fsr2.Read(btArr, Convert.ToInt32(fsr1.Length), Convert.ToInt32(fsr2.Length));
fsr1.Close();
fsr2.Close();
FileStream fsw = new FileStream(%%2 + Path.DirectorySeparatorChar+ strFileName, FileMode.Create, FileAccess.Write);
fsw.Write(btArr, 0, btArr.Length);
fsw.Flush();
fsw.Close();
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template