如何写在Windows应用商店txt文件? [英] How to write txt file in windows app store?
本文介绍了如何写在Windows应用商店txt文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在寻找了一夜,以弄清楚如何txt文件写入到如D的特定位置:\
I试过的StreamWriter
和有System.IO.File
这是不包含在App Store中的应用程序
,没有运气至今
I将不胜感激任何帮助。
i have been searching all night to figure out how to write txt file to a specific location like D:\
i tried the StreamWriter
and System.IO.File
which is not included in the app store applications
with no luck so far
i would appreciate any help.
推荐答案
您不能因为他们是沙盒写从Windows Store应用程序的任何位置,你只能写应用程序的本地文件夹:
You can't write to any location from Windows Store apps because they are sandboxed, you can only write to app's local folder:
string text = "Hello, world";
StorageFolder folder = ApplicationData.Current.LocalFolder;
StorageFile file = await folder.CreateFileAsync("data.txt");
if (file != null)
{
await FileIO.WriteTextAsync(file, text);
}
这篇关于如何写在Windows应用商店txt文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文