When I try to create a byte array to read a file that's 1GB in size, I get System.OutOfMemoryException. I assume this means there isn't enough system memory to allocate an array of bytes this large.
Is there some other way I can read this file, possibly in chunks, to deal with it?
Code:System.IO.FileInfo fi = new System.IO.FileInfo(txtRead.Text); byte[] bt; try { bt = new byte[fi.Length]; bt = System.IO.File.ReadAllBytes(txtRead.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); }




Reply With Quote