使用
streamwriter reader
读写是不同的档案
在自己的电脑使用正常
在某部份电脑却没有work
似乎没读到内容
写档有create出file 但0kb
static class Constants
{
public const string LogFileDirectory = @"C:\ABC";
public const string LogFileName = "ChangeLog.dat";
public const string LogBakFileName = "ChangeLog.bak";
public const string DebugLogFileName = "ErrorLog.dat";
}
public MainWindow()
{
InitializeComponent();
string str = "";
if
(System.IO.File.Exists(System.IO.Path.Combine(Constants.LogFileDirectory,
Constants.DebugLogFileName)))
{
StreamReader sr = new
StreamReader(System.IO.Path.Combine(Constants.LogFileDirectory,
Constants.DebugLogFileName));
str = sr.ReadToEnd();
sr.Close();
}
sw = new
StreamWriter(System.IO.Path.Combine(Constants.LogFileDirectory,
Constants.DebugLogFileName));
sw.WriteLine(str + " ====== work start " + GetNowDateString() + "
====== ");
sw.WriteLine(" ====== work end " + GetNowDateString() + " ====== ");
sw.Close();
不知道该从何下手..