locked
Append content at the end of file RRS feed

  • Question

  • Hi,

    I am using stream stream writer to write the contents in following way.

      using (Windows.Storage.Streams.IRandomAccessStream writeStream = await file.OpenAsync(FileAccessMode.ReadWrite))
                {
                    using (TextWriter TW= new StreamWriter(writeStream.AsStream()))
                    {
                       
                        foreach (item in ITEMS)
                        {                        
                            item.Write(TW);
                        }
                    }
                }

    here i am using separate method to write the contents 'Write' and passing streamWriter to write appropriate values.

    Please suggest me how can i write content to the end of file and without loosing previous data.

    Thanks,

     

    C Mahone

    Thursday, October 3, 2013 1:32 PM

Answers

  • You can seek your stream past the end of the existing text.
    • Marked as answer by Anne Jing Thursday, October 10, 2013 8:40 AM
    Thursday, October 3, 2013 5:29 PM
    Moderator