和bitcomment那样,在下载前先分配好空间,减少磁盘碎片。

解决方案 »

  1.   

    楼主,你是想检查磁盘空间是否足够?还是要实实在在地分配一块空间?分配空间:
    FileStream fs = new FileStream("test.txt",FileMode.Create,
    FileAccess.ReadWrite,FileShare.Read);
    fs.SetLength( 50000000L);//分配了50000000个字节给test.txt文件
      

  2.   

    //不要忘了捕获异常
    try{
      fs.SetLength( 50000000L);//
    }
    catch(Exception)
    {
      MessageBox.Show("Failed to allocate disk space");
    }