Answer the question
In order to leave comments, you need to log in
How to do selective editing of txt UTF8 file in C# without full reading?
It is necessary in the TXT file to replace from 15 to 20 characters with others. How can I do this without reading the entire file. UTF8 format without BOM.
Answer the question
In order to leave comments, you need to log in
No way, UTF has a dynamic character size, so you can't position yourself on the desired character without reading the previous ones. Accordingly, if there is an unequal replacement in terms of the number of bytes, then in any case you will have to move apart, and this will require a complete reading of the file. In general, if this TXT file is not a gigabyte size, I would not bother, read it in its entirety, replace it and write it back.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question