[C/C++] Task07 (에러로그파일처리) 로그남기기
본 자료는 미리보기를 지원하지 않습니다.
닫기
  • 1
  • 2
  • 3
해당 자료는 1페이지 까지만 미리보기를 제공합니다.
1페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

[C/C++] Task07 (에러로그파일처리) 로그남기기에 대한 보고서 자료입니다.

목차

main.cpp             903바이트
Task06(에러로그).sln       905바이트
Task06(에러로그).vcproj      3.51KB
 

본문내용

#include
using namespace std;

#include

void GetTime(char *szTime, int size)
{
/* Visual Studio 6.0 버전 사용시
time_t t;
time(&t);
strftime(szTime,128,"%Y-%m-%d/%H:%M:%S",localtime(&t));
*/

// Visual Studio 2005버전이상 사용시
time_t timer;
struct tm t;

timer = time(NULL); // 현재 시각을 초 단위로 얻기
localtime_s(&t, &timer);

sprintf_s(szTime, size, "%d-%d-%d / %d:%d:%d : ",
t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
}

int main(void)
{
char szTemp[128] = {0,};
FILE* pFile;
int iCount=1;

fopen_s(&pFile, "ErrorLog.txt", "a+");

fseek(pFile, 0, SEEK_SET);
while(!feof(pFile))
{
if(fgetc(pFile)==10)
{
iCount = iCount + 1;
}
}
GetTime(szTemp, sizeof(szTemp));
fprintf(pFile, "%3d %s %s\n", iCount, szTemp, "현시간부터 에러발생");
fclose(pFile);

return 0;
}

키워드

로그,   에러로그,   프로그램,   C,   C++
  • 가격500
  • 페이지수3페이지
  • 등록일2011.07.26
  • 저작시기2010.9
  • 파일형식압축파일(zip)
  • 자료번호#691218
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니