打开C#中的文本文件 [英] Open a text file in C#

查看:157
本文介绍了打开C#中的文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的,我记录一些数据的程序运行时一个Windows窗体应用程序,我把它写在与此代码一个临时文件:

I'm writing a Windows-Forms Application in which I log some Data while the program is running and I write it in a temporary file with this code:

string path = Path.GetTempFileName();
byte[] text = new UTF8Encoding(true).GetBytes("Some Text");
using (FileStream fs = File.Open(path, FileMode.Open, FileAccess.Write, FileShare.None))
{
    fs.Write(text, 0, text.Length);
}



穿过我要显示/在Microsoft打开该文件后,PROGRAMM编辑。我怎样才能做到这一点。我用Google搜索周围,但我没有发现任何东西,也许我搜索了错误的话。
希望你能帮助我。

After the programm passed through I want to show/open the file in the Microsoft Editor. How can I do it. I googled around but I didn't find anything, maybe i searched with the wrong words. Hope you can help me.

推荐答案

尝试:

Process.Start("Yourfile.txt")

这篇关于打开C#中的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆