Programmatically Deleting Data from a File
I am trying to find a way to remove data from a file using C#.
I know how to edit using FileStream.Seek and a StreamWriter, and I know how to append data to the end, but I haven't found a way to actually remove data from the end of a file.
Due to file size and memory constraints, reading the whole thing in, saving it as a new file, and then deleting the old file is not an option.
Is there a way to write an EOF where I specify, and that's that? (if so, how do you actually do that?) Or do I have to go about doing this some other way?
Thanks in advance for the help,
Jonathan Mitchem
Answers
Know the answer? Post it. Somebody with the same question will find it here.