This is the problem I wanted to solve:
Create a file, add data and Save it in isolatedStorage.
Open the file, add more data to this file.
How do I append data into this file? Will the new data line up ahead of the old data?
Some code will be appreciated.
Thanks
Your code looks like this (from your comment in the question - next time edit the question and insert the code so it's more readable and we don't have to repost it):
StreamWriter writeFile = new StreamWriter(
new IsolatedStorageFileStream(
txtBlkDirName.Text + "\\" + strFilenm,
FileMode.OpenOrCreate,
isf));
writeFile.WriteLine(txtPreSetMsg.Text); writeFile.Close();
Note that the mode you use is OpenOrCreate
, which is going to open the existing file and put your stream pointer at the start. If you immediately start writing, it's going to overwrite anything in the file.
Your options for appending would be:
FileMode.Append
instead so the pointer is already at the end of the stream after opening Seek(0, SeekOrigin.End)
to move the pointer to the end of the file manually.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With