Editing a text file in place through C#

后端 未结 4 1911
攒了一身酷
攒了一身酷 2020-12-07 01:10

I have a huge text file, size > 4GB and I want to replace some text in it programmatically. I know the line number at which I have to replace the text but the problem is tha

4条回答
  •  爱一瞬间的悲伤
    2020-12-07 01:46

    Unless the new text is exactly the same size as the old text, you will have to re-write the file. There is no way around it. You can at least do this without keeping the entire file in memory.

提交回复
热议问题