what is the best method of concatenating a series of binary files into one file?
- by Andrew
hello everyone
i have a series of PDF byte arrays in a arraylist files that i wish to concatenate into one file,
currently when the PDF application trys to open the file is it corrupted:
foreach (byte[] array in files)
{
using (Stream s = new MemoryStream(downloadbytes))
{
s.Write(array, 0, array.Length);
}
}
downloadbytes is the resultant concatenated array of bytes below is another implementation which also failed
foreach (byte[] array in files)
{
System.Buffer.BlockCopy(array, 0, downloadbytes, offset, array.Length);
offset += array.Length;
}
any pointers?