Good day to all. I need to insert bytes into the stream, but the fact is that if there is a stream, say the string "123456789", then if I write the string "abc" in it from the second byte, it turns out "12abv6789", and I need to "12abv3456789". Is there a way to insert bytes into the stream?
public int WriteData(int offset, string data) { try { byte[] bytes = new byte[data.Length]; bytes = Encoding.UTF8.GetBytes(data); fileStream.Seek(offset, SeekOrigin.Begin); fileStream.Write(bytes, 0, bytes.Length); } catch (Exception ex) { return 1; } return 0; }