简单IO,将一段字符串存入一个记事本
2024-10-01 22:24:00
using System;
using System.IO;
using System.Text; namespace 字符串存入记事本
{
class Program
{
static void Main(string[] args)
{
StringBuilder sb = new StringBuilder();
for (int i = ; i < ; i++)
{
sb.AppendLine("简单创建一个有很多文字内容的记事本");
}
string str=sb.ToString(); string filePath = "d:\\截止"+ DateTime.Now.ToString("yyyy-MM-dd") + "7天没有采集到的模块.txt";
FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
fs.SetLength();//首先把文件清空了。
sw.Write(str);//写你的字符串。
sw.Close();
Console.WriteLine("已经结束");
/////////////////////以下是运行这个文件/////////////////////////
//Process p = new Process();
//p.StartInfo.FileName = filePath;
//p.Start();
Console.ReadKey();
}
}
}
最新文章
- MySQL:Fabric 安装
- PHP自带防SQL攻击函数区别
- irc操作小记
- Android之源码之模块编译和调试
- 在CentOS下利用Eclipse调试FFmpeg
- Storm系列之二——Guaranteeing Message Processing
- NGUI Tutorial 3
- PHP内置函数
- C#日期时间格式化
- js 中&;&; 与 ||
- The hacker&#39;s sanbox游戏
- Python之常用模块(待更新)
- [Android学习笔记]LayoutParams的使用
- win10下安装python2与python3以及pip共存
- 201521044091《Java程序设计》第7周学习总结
- github搭建个人网站
- python 字符串 切片
- 美团codeM预赛A轮 倒水
- 【Spark】榨干Spark性能-driver、exector内存突破256M
- Zookeeper笔记之quota
热门文章
- linux的关机
- WindowImplBase::OnSysCommand-------duilib在最大化和还原间切换
- stm32 DMA+timer+DAC
- 洛谷 P4013 数字梯形问题
- PatentTips - Multi-host SATA Controller
- [ES7] Convert Any Function into an Asynchronous Function
- 【转】request和response的页面跳转
- iptables 重启系统生效
- 微信小程序从零开始开发步骤(二)
- html5常用标签table表格布局