I have to split huge file into many smaller files. each of the destination file is defined by offset and length as number of bytes. I'm using the following code:
private void copy(string srcFile, string dstFile, int offset, int length)
BinaryReader reader = new BinaryReader(File.OpenRead(srcFile));
byte buffer = reader.ReadBytes(length);
BinaryWriter writer = new BinaryWriter(File.OpenWrite(dstFile));
Considering that I have to call this function about 100,000 times, it is remarkably slow.
Is there a way to make the Writer connected directly to the Reader?