c# 中操作文本
来源:互联网 发布:java编程题库 编辑:程序博客网 时间:2024/05/01 08:56
创建文本:
string path;
path=@Application.StartupPath+"//log//log"+DateTime.Now.ToString("yyyy-MM--dd hhmmss")+".txt";
StreamWriter sw=File.CreateText(path);
sw.Write("hello");
sw.WriteLine("hello");
sw.Close();
读取文本
string str;
string address="";
FileStream fs;
string path;
path=Application.StartupPath+"//log//"+"1.txt";
try
{
fs=new FileStream(path,FileMode.OpenOrCreate);
}
catch(FileNotFoundException ex)
{
MessageBox.Show("读取文件出现错误!"+ex.Message,"错误",0x00);
return;
}
StreamReader sr=new StreamReader(fs);
while((str=sr.ReadLine())!=null)
{
address=address+str;
}
sr.Close();
- c# 中操作文本
- c# wince 文本操作
- C# 操作记事本文本
- C#实现在Excel中搜索文本(遍历操作)
- unity3d C#文本读写操作
- C#中操作Excel(3)—— Excel中操作文本、图片和批注
- C#中控件文本滚动
- C#中操作Word(4)—— 利用Range对象设置文本的格式
- C#文本操作的所有方法
- C#操作word之文本替换
- C#操作word之文本批量替换
- c#操作txt文本之查询
- c#操作txt文本之写入
- C# 创建目录 写入文本 基础文本操作
- C# 中操作API:
- C# 中操作API
- C#中操作注册表
- c#中操作注册表
- iostream.h和iostream 区别
- Windows下Cacti高级应用--打造自己的Cacti模板 -5
- Visualize:一个jQuery可视化插件
- C++标准ISO-IEC-14882-2003:第14章:模板-第4节:类型等价
- 在visual studio 2005 下建立openGL开发环境 - [学习日志]
- c# 中操作文本
- SQL重复记录处理
- HL7 数据是如何被处理的(译文)
- Adobe的flash player版本检测代码在本人电脑上失效!
- 朱棣文清华演讲中英文幻灯片下载
- 双色球彩票程序
- 关于使用dom4j生成xml时特殊字符处理的解决方法
- 今天就是礼物
- Session Episode