W
Wootaek Choi
I've tried to record some data to the file with C#.
The data should be added in the end of log file,
And If there is no log file, A new log file should be created to write
the data
for that reason, AppendText() function used to open the log file.
but AppendText() returns StreamWriter object using utf-8 encode mode.
What shall i do to get a StreamWriter object using the other encode
mode when i use AppendText()?
Here is my code...
+--------------------------------------------------------------------
| FileInfo logFile = new FileInfo(dirInfo.FullName+"\\"+path);
| StreamWriter writer = logFile.AppendText();
| writer.WriteLine(
| "["+DateUtility.getTimeIn24Format() +"] "+
| logStr.Replace("\n",writer.NewLine) );
| writer.Close();
+---------------------------------------------------------------------
The data should be added in the end of log file,
And If there is no log file, A new log file should be created to write
the data
for that reason, AppendText() function used to open the log file.
but AppendText() returns StreamWriter object using utf-8 encode mode.
What shall i do to get a StreamWriter object using the other encode
mode when i use AppendText()?
Here is my code...
+--------------------------------------------------------------------
| FileInfo logFile = new FileInfo(dirInfo.FullName+"\\"+path);
| StreamWriter writer = logFile.AppendText();
| writer.WriteLine(
| "["+DateUtility.getTimeIn24Format() +"] "+
| logStr.Replace("\n",writer.NewLine) );
| writer.Close();
+---------------------------------------------------------------------