View Single Post
  #6  
Old 05-13-2013, 01:42 PM
August August is offline
Fire Giant


Join Date: Sep 2010
Posts: 703
Default

The problem with trying to load a file such as this is that most programs are going to load the entirety of the file into memory. How much memory do you have? IF its not significantly over 4GB, you're hosed.

You could also just stop trying to find the solution and create one yourself:

void ReadAndWrite()
{
System.IO.StreamReader InFile= new System.IO.StreamReader("c:\\myeqlog.txt");



for(int n=0; n<1000; n++)
{
System.IO.StreamWriter OutFile= new System.IO.StreamWriter(@"C:\MyEQLog"+n);
Count = 0;
while((line = file.ReadLine()) != null && Count <1000)
{
Outfile.WriteLine (line);
Count ++;
}
OutFile.Close();
}
InFile.Close();
}

This is purely from general memory. Basically, open a stream on the file. Read in 1000 lines, output a thousand lines, increment your logname - rinse and repeat. This will let you choose how large of file chunks you want ( by changing count). You probably also need to generate a new file name somewhat diffrerently - i'm not sure the way i did it would compile and I'm lazy.

-Tomtee
Last edited by August; 05-13-2013 at 02:06 PM..