//****××××××日期 精确到毫秒 + R/W(读/写)+ 数据
//写入格式为2019-06-10 16:00:03:0919 R 00 FF 00 0D 80 01 00 00 08 5A DB 54
//***
以下为具体实现过程:
//.CPP
#define WRITE_SIZE 1024
CMutex g_clsWriteMutex(FALSE, NULL);
//.H
CFile file;
CString m_strFilePath;
CString strPath;
CString filePath;
//.CPP
CString GetFilePath()
{
TCHAR pFileName[MAX_PATH + 1];
GetModuleFileName(NULL, pFileName, MAX_PATH);
strPath = pFileName;
filePath = strPath.Left(strPath.ReverseFind('\\'));
return filePath;
}
CString GetSYStime()
{
SYSTEMTIME st = { 0 };
GetLocalTime(&st); //获取当前时间 精确到ms
CString strSysTime;
strSysTime.Format("%d-%02d-%02d %02d:%02d:%02d:%04d",
st.wYear,
st.wMonth,
st.wDay,
st.wHour,
st.wMinute,
st.wSecond,
st.wMilliseconds);
//返回格式为2019-06-10 16:00:03:0919
return strSysTime;
}
//****×××