StreamWriter and IsolatedStorageFile
本文关键字:IsolatedStorageFile and StreamWriter | 更新日期: 2023-09-27 18:29:41
IsolatedStorageFile iF = IsolatedStorageFile.GetUserStoreForApplication();
if (!iF.DirectoryExists("aaa"))
{
MessageBox.Show("No directory, create!");
iF.CreateDirectory("aaa");
}
StreamWriter fW = new StreamWriter(new IsolatedStorageFileStream("girls''list.txt", FileMode.OpenOrCreate, iF));
fW.WriteLine(this.tb_name.Text);
因此,我创建文件或打开它,并向其中添加文本框的内容。我需要附加此文件,但它会重写。请帮我解决这个问题:)谢谢!
你想要FileMode.Append
,而不是FileMode.OpenOrCreate
有关详细信息,请参阅此页面 http://msdn.microsoft.com/en-us/library/system.io.filemode(v=vs.95(.aspx
追加:打开文件(如果存在(并查找到文件末尾,或者 创建一个新文件。
如果存在,请使用FileMode.Append
,如果不存在,则FileMode.Create
。