programming files of size larger than 2 GB using C#.Net

谁说我不能喝 提交于 2020-01-04 09:14:12

问题


How to write large content to disk dynamically using c sharp. any advice or reference is appreciated.

Iam trying to create a file(custom format and extension)and writing to it. The User will upload a file and its contents are converted to byte stream and is written to the file(filename.hd).The indexing of the uploaded files is done in another file(filename.hi).

This works fine for me when the "filename.hd" file size is 2 GB when it exceeds 2GB it is not allowing me to add the content.This is my problem.

After googling i found that the FAT 32 windows based system (most of the versions) only support 2GB of file size.Is there any solution for me to handle this situation.Please let me know.

Thanks in advance sree


回答1:


Use another filesystem (e.g. NTFS) ?




回答2:


Use StreamWriter for writing to disk. StringBuilder is recommended to create the string, since when using 'string' appending two strings really creates a new string, which hurts preformance.




回答3:


Okay you will have some restrictions that are not code related: File system - FAT and FAT32 will restrict you. Whether the system is 16, 32 or 64 bit will place restrictions on you.



来源:https://stackoverflow.com/questions/1124034/programming-files-of-size-larger-than-2-gb-using-c-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!