I would like to pre-pend(to the beginning) a file with a string in C#.
Currently, I am just replacing content of the file with my string plus original content.
I DO NOT WANT TO DO THIS, because streamwriter will mess-up encoded characters.
Is there a way to pre-pend a text file without changing it’s original encoding(of each character).
There is gotta be a way.
The code at the bottom of this page appears to let you Read a file in, retain the encoding and then write it back out using the same encoding. You should be able to modify this to do what you need.