日志.VC
1、
int WriteLog(char* _pcFullFileName, char* _pcWrite, int _iWriteLen, unsigned long * _pdwWritten) { HANDLE hLogFile = CreateFileA(_pcFullFileName, GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS/*CREATE_NEW*/, 0, 0);// ZC: 存在:打开;不存在:创建 if (hLogFile == INVALID_HANDLE_VALUE) return GetLastError(); if (INVALID_SET_FILE_POINTER == SetFilePointer(hLogFile, 0, 0, FILE_END)) { int iErr = GetLastError(); CloseHandle(hLogFile); return iErr; } BOOL B = WriteFile(hLogFile, _pcWrite, _iWriteLen, _pdwWritten, NULL); if (!B) { int iErr = GetLastError(); CloseHandle(hLogFile); return iErr; } CloseHandle(hLogFile); return 0; }
2、
3、
4、
5、