1
Answer

Read/Write Search/Change text files using a binary method

Ask a question
Eduardo

Eduardo

14y
2.8k
1
Hi guys,
I am using C# Visual Studio .Net 2008.

What I want to do:
- open a file, do search and changes, save changes of the file

But!

The file is a txt file, but the first 4 characters are binary (I don't know if there are more binary characteres). When I save the file, i lost the binary part and the Application that will use this file says that the file is corrupted... :(

I am using StreamReader and StreamWriter to do this but i need another way to open the file using a binary format and make changes like search and replace using text mode and finally save the file using binary mode again.

What i want is just like notepad++ does :D

Any ideas?
Thanks!

†GnR† Slash

Answers (1)