I have several files on my hard drive that need to be put back together as one file and written back to the hard drive. the files total over 2GB so it is producing the following error while i work with them: “OutOfMemoryException: Out of memory.” i think my code is simply taking too much ram.
the files are named “part01.tdd”, “part02.tdd” ,“part03.tdd” and so on. They simply need to be read into byte arrays and stacked together end to end to make a file!
Anyone have any other ideas?
i=0;bt=new byte[0];
while(i>-1){
if(i<10){txt="0"+i;}else{txt=""+i;}
txt=dir+"/"+"part"+txt+".tdd";
if(File.Exists(txt)){
bt=bt+File.ReadAllBytes(txt);// <--error is here
i++;}
else{i=-1;}
}
print("saving"+bt.Length);
File.WriteAllBytes(dir+"/"+dstring+"/"+dstring+".mp4",bt);