增加带有毫秒的日志log

#include<stdio.h>  
#include<sys/timeb.h>   
CString file_path = L"C:\\HHTmp\\DicomTmp\\send.txt";  



CTime Tm=CTime::GetCurrentTime();  
int nYear,nMonth,nDay,nHour,nMinute,nSecond,nMinSecond;  
CString g_szDateTime;  
nYear=Tm.GetYear();  
nMonth=Tm.GetMonth();  
nDay=Tm.GetDay();  
nHour=Tm.GetHour();  
nMinute=Tm.GetMinute();  
nSecond=Tm.GetSecond();  
CString mSecond;  
struct _timeb timebuffer1;  
_ftime(&timebuffer1);  
mSecond.Format(_T("%d"),timebuffer1.millitm);  
nMinSecond=_wtoi(mSecond);  
g_szDateTime.Format(_T("下start%04d/%02d/%02d/%02d:%02d:%02d:%3d"),nYear,nMonth,nDay,nHour,  
nMinute,nSecond,nMinSecond);     
{  
CFile file(file_path,CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate);    
CString str = L"\r\n";  
file.SeekToEnd();  
file.Write(g_szDateTime.GetBuffer(),g_szDateTime.GetLength()*sizeof(TCHAR));  
file.Write(str.GetBuffer(),str.GetLength()*sizeof(TCHAR));  
file.Close();  
}  



m_printView->TurnPage(WM_PrintNextPage);




CTime Tm1=CTime::GetCurrentTime();  
nYear=Tm1.GetYear();  
nMonth=Tm1.GetMonth();  
nDay=Tm1.GetDay();  
nHour=Tm1.GetHour();  
nMinute=Tm1.GetMinute();  
nSecond=Tm1.GetSecond();  
struct _timeb timebuffer2;  
_ftime(&timebuffer2);  
mSecond.Format(_T("%d"),timebuffer2.millitm);  
nMinSecond=_wtoi(mSecond);  
g_szDateTime.Format(_T("下end%04d/%02d/%02d/%02d:%02d:%02d:%3d"),nYear,nMonth,nDay,nHour,  
nMinute,nSecond,nMinSecond);     
{  
CFile file(file_path,CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate);    
CString str = L"\r\n";  
file1.SeekToEnd();  
file1.Write(g_szDateTime.GetBuffer(),g_szDateTime.GetLength()*sizeof(TCHAR));  
file1.Write(str.GetBuffer(),str.GetLength()*sizeof(TCHAR));  
file1.Close();  
}  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值