[問題] streamwriter reader在不同環境下不work
使用
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();
不知道該從何下手..
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 219.87.85.162
※ 文章網址: https://www.ptt.cc/bbs/C_Sharp/M.1460432399.A.935.html
推
04/12 12:08, , 1F
04/12 12:08, 1F
推
04/12 12:13, , 2F
04/12 12:13, 2F
OK~
PO個大概的
※ 編輯: b26168 (219.87.85.162), 04/12/2016 12:24:22
推
04/12 12:43, , 3F
04/12 12:43, 3F
→
04/12 12:43, , 4F
04/12 12:43, 4F
→
04/12 12:45, , 5F
04/12 12:45, 5F
→
04/12 16:51, , 6F
04/12 16:51, 6F
→
04/12 16:52, , 7F
04/12 16:52, 7F
推
04/12 18:43, , 8F
04/12 18:43, 8F
→
04/12 18:44, , 9F
04/12 18:44, 9F
推
04/12 18:54, , 10F
04/12 18:54, 10F
→
04/12 23:25, , 11F
04/12 23:25, 11F
推
04/13 09:16, , 12F
04/13 09:16, 12F
→
04/13 09:16, , 13F
04/13 09:16, 13F
→
04/13 09:16, , 14F
04/13 09:16, 14F
→
04/13 12:24, , 15F
04/13 12:24, 15F
→
04/13 12:24, , 16F
04/13 12:24, 16F
推
04/13 12:27, , 17F
04/13 12:27, 17F
→
04/13 12:33, , 18F
04/13 12:33, 18F
→
04/13 12:33, , 19F
04/13 12:33, 19F
推
04/13 13:42, , 20F
04/13 13:42, 20F
→
04/13 13:42, , 21F
04/13 13:42, 21F
→
04/18 17:45, , 22F
04/18 17:45, 22F
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章