Creating Large Files

Tuesday, January 24, 2006 6:00:00 AM (GMT Standard Time, UTC+00:00)
Right now I am working on a extended version of the application updater block for a client, as part of the testing I needed to create some large files to test the download progress dialog.  It can actually be done pretty easily after spending a couple of minutes poking around the BCL.
 
System.IO.FileStream fs = new System.IO.FileStream(@"c:\test2.bin", System.IO.FileMode.Create);
fs.SetLength(1000000 * 1000); //creates about a gig
fs.Close();
 
Warning: Be care that you have enough space on your drive when you do this, you may run into some problems if you don’t.
Comments are closed.