Preallocating file space in C#?

后端 未结 3 507
清酒与你
清酒与你 2021-02-05 08:40

I am creating a downloading application and I wish to preallocate room on the harddrive for the files before they are actually downloaded as they could potentially be rather lar

3条回答
  •  鱼传尺愫
    2021-02-05 09:36

    Unfortunately, you can't really do this just by seeking to the end. That will set the file length to something huge, but may not actually allocate disk blocks for storage. So when you go to write the file, it will still fail.

提交回复
热议问题