How can you normally separate the lines in the byte array and then read them? for example

w = new BinaryWriter(m); public void WriteUTF8String(string val, bool nullTerminated = true) { if (nullTerminated) val += '\0'; w.Write(Encoding.UTF8.GetBytes(val)); } 

In w bytes, you can write an infinite number of lines, then how can they be considered normal?

The finished function as I understand it to read completely to the end

 public string ReadString() { return r.ReadString(); } 

How do I understand it is necessary to read an array of bytes until a separator of the type '\ 0' is detected?

  • 2
    And what do you BinaryWriter.Write(string) bad? It writes a string, prefixing it with a length, then using BinaryReader.ReadString() it reads normally. - i-one

0