写入到txt的类
来源:互联网 发布:临汾行知学校简介 编辑:程序博客网 时间:2024/05/23 15:35
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace AutoService{ class WriteLog { static String path = AppDomain.CurrentDomain.BaseDirectory;//当前服务所在路径 static String fileName = path+"ServiceLog.txt"; static StreamWriter sw = null; static StreamReader sr = null; static char[] ch; private static bool isUse = true; private static void init() { string a = Environment.CurrentDirectory; if (File.Exists(fileName)) { sr = new StreamReader(fileName); int length = (int)sr.BaseStream.Length; ch = new char[length]; sr.ReadBlock(ch, 0, length); sr.Close(); sw = new StreamWriter(fileName); sw.Write(new String(ch)); } else { sw = new StreamWriter(fileName); } } public static void toLog(String log) { if (isUse) { init(); isUse = false; } sw.WriteLine(DateTime.Now.ToString() + " " + log); sw.Flush(); } }}
- 写入到txt的类
- txt文件的读取以及按规律写入到另一个txt文件中
- java将数据写入到txt文件中(txt有固定的格式)
- MATLAB读取txt文件,并逐行处理字符串,写入到新的txt中
- csv或者txt文件写入到数据库
- 将Excel数据写入到TXT中
- OC字符串写入到.txt文件中
- 将字符串写入到txt文件中
- File 写入/n 到txt识别不了
- 将list数据写入到txt中
- 数组写入Txt 与读Txt到数组 C++
- 24、合并两个无序数组,并把合并后的升序数组写入到a.txt中,降序数组写入到b.txt中。要求去掉重复元素
- 简单的-写入txt文本,追加写入与覆盖写入
- Python 多线程搜索txt文件的内容,并写入搜到的内容(Lock)
- 将不同的log(infoLog,errorLog,debugLog等)写入到txt文件中
- 用java实现把数据库的数据写入到txt中
- java进行日期的加减,并写入到txt文件从中读取出来
- java的io操作(将字符串写入到txt文件中)
- 自己动手写Web自动化测试框架(7):框架架构的设计
- Window_Open详解
- 文件对话框的用法(CFileDialog)
- C++类静态成员与类静态成员函数
- C中的预编译宏定义
- 写入到txt的类
- 关于impacket.ImpactDecoder解包器
- ISD17系列语音芯片的地址计算方法
- 表格边框虚线显示
- hadoop日志【4】----50G数据
- liunx php的GD库 添加 jpeg 文件的支持
- powershell 远程执行命令失败
- 链式前向星
- screen 使用