In windows phone 8.1 i want to use streamwriter in text, and appending text to file end. But the text is appended to the beginning of the file. how to appending text to file end?
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///input_category_list.txt"));
using (StreamWriter sWrite = new StreamWriter(await file.OpenStreamForWriteAsync(), System.Text.UTF8Encoding.UTF8))
{
sWrite.WriteLine(write_category_box.Text);
await sWrite.FlushAsync();
}
There's no need for StreamWriter
in Windows Runtime, you can use FileIO
class (which is easier):
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(@"ms-appx:///input_category_list.txt"));
await FileIO.AppendTextAsync(file, write_category_box.Text, UnicodeEncoding.Utf8);