How to write data at a particular position in c#?

后端 未结 4 701

I am making an application in c#. In that application I have one byte array and I want to write that byte array data to particular position.

Here i used the followin

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 06:38

    You can set the position inside the stream like this:

    writer.BaseStream.Seek( 1000, SeekOrigin.Begin);
    

    Add this before your WriteLine code.

    Note that I have not included any code to check that there is at least 1000 chars inside the file to start with.

提交回复
热议问题