Updating a file in place

Create a new temporary file and write everything to that instead. It's easier and safer (i.e., if something goes wrong, delete the temporary and the original remains intact).I have to open a text file in c# and read few lines and then I need to update some lines in the middle of the file.You need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster.

I can read and write by using the stream Reader or stream Writer but I don't know how to read for example five lines and then update the sixth line and continou to read few lines, update few etc.

I'd suggest storing them in two arrays of five bytes each. Once you do that, you can write the first five bytes of the buffer after hello.

Then, read the next five bytes in the file and store them in the buffer (this is why I recommend two buffers, so you can just swap references as opposed to having to copy all the bytes around in a single buffer).

Now suppose you want each Pod to have two containers: one that runs nginx and one that runs redis.

Create a file named The output shows that the running Pods have different names from the Pods that were running previously. In other words, the list in the patch was merged with the existing list.

Search for updating a file in place:

updating a file in place-77updating a file in place-14

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating a file in place”