I create a text file by this code:
StorageFile file = await DownloadsFolder.CreateFileAsync(
listFile.Name, CreationCollisionOption.GenerateUniqueName);
try
{
await FileIO.AppendTextAsync(file, user.ID + ", " + user.Username + ","
+ name + ", " + user.Follower + ", " + user.Following + ", "
+ user.Post + ", " + user.MidLike + ", " + user.Public + ", "
+ Biography + ", " + user.LastPage.ToShortDateString() + ", "
+ user.Kind + ", " + user.Like + ", " + user.CM + ", "
+ user.View + ", " + Cap + "\r\n");
await CachedFileManager.CompleteUpdatesAsync(file);
}
catch(Exception ex)
{
MessageDialog message = new MessageDialog(ex.ToString());
await message.ShowAsync();
}
Sometimes I get the following error:
{System.Exception: Unable to remove the file to be replaced. (Exception from HRESULT: 0x80070497) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Khorma.CommandPage.d__6.MoveNext()}
User contributions licensed under CC BY-SA 3.0