本文介绍了以与输入文件相同的名称保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我想保存一个与使用打开文件"对话框打开的原始文件同名的文本文件.
我使用打开文件对话框并具有
Hi all,
I would like to save a text file the same name as the original file I open using the open file dialog.
I use open file dialog and have
ArrayList fileList = new ArrayList;
foreach(string file in fileList) //where file =C:\Users\Iman\Desktop\Thermo Data\gygi_vp_0014.mgf
{
//do stuff
//and write to text with original filename "gygi_vp0014.mgf" + "modified"
streamwriter sw = new streamwriter( what do I put here")
}
Thanks in advance!
推荐答案
using (StreamWriter writer= new StreamWriter("test.txt"))
{
while(true); // note, it fills the disk up very quickly.
{
writer.WriteLine("test StreamWriter");
writer.Flush();
}
}
这篇关于以与输入文件相同的名称保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!