I want to create a huge dummy file say 1~2 GBs in matter of seconds. here is what I\'ve written in C# :
file.writeallbytes(\"filename\",new byte[a huge numbe
If you just need a FileStream
, you could use FileStream.SetLength
. That will get you a stream which is 2 GB long. Then you can write the final byte at an arbitrary position of your choice. But the contents will be undefined.
If you're trying to actually create a file on the disk, yes, you'll need to actually write its contents. And yes, hard disks are going to be slow; something like a 1 GB/min write speed isn't totally ridiculous. Sorry -- that's physics!