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);所以,我创建了一个文件,或者打开它,然后添加textbox的内容。我需要追加这个文件,但它会重写。请帮我解决这个问题:)谢谢!
发布于 2012-04-02 22:50:04
你想要FileMode.Append,而不是FileMode.OpenOrCreate
有关详细信息http://msdn.microsoft.com/en-us/library/system.io.filemode(v=vs.95).aspx,请参阅此页面
Append:如果文件存在,则打开该文件并查找到文件的末尾,或者创建一个新文件。
发布于 2012-04-02 22:48:34
如果存在,则使用FileMode.Append;如果不存在,则使用FileMode.Create。
https://stackoverflow.com/questions/9978501
复制相似问题