|
함수를 하나 작성하였습니다.
1줄은 로깅이 잘 되는데 그담부터 연이어 작성시 텍스트파일이 코드페이지 에러나듯이 늘어나네요
고견 부탁드립니다
void __fastcall TfrmMain::PrintLog(String p_strLog)
{
String strLog = "["+ Date().FormatString("yyyy-MM-dd") + " " + Time().FormatString("hh:nn:ss") + "] #" + p_strLog + "\\n";
String strFileName = m_strLogPath + Date().FormatString("yyyyMMdd")+".log";
int fh;
if(FileExists(strFileName))
fh = FileOpen(strFileName, fmOpenReadWrite);
else
fh = FileCreate(strFileName);
try
{
FileSeek(fh, 0, 2);
FileWrite(fh, strLog.c_str(), strLog.Length());
}
__finally
{
FileClose(fh);
}
}
|