목차
main.cpp 903바이트
Task06(에러로그).sln 905바이트
Task06(에러로그).vcproj 3.51KB
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;
}
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언어 OpenGL)
[자료구조]Infix로 된 수식을 Prefix와 Postfix로 변환 시키는 프로그램입니다.(C언어)
C언어를 이용한 암호화 프로그램
c언어를 이용한 바둑 프로그램, 바둑 소스
C로 짠 CGI 프로그램 소스 분석 및 실행
c언어로 만든 켤레복소수함수 프로그램
2010년 2학기 아동복지 중간시험과제물 C형(영유아보육프로그램 질적수준발전방향)
C언어로 상하좌우 이동하는 프로그램 코딩
자료구조 프로그램 (C언어)
C 드라이브 자동백업 프로그램
2016년 2학기 영유아프로그램개발과평가 중간시험과제물 C형(레지오 에밀리아 접근법)
소개글