1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
// FilesOperation.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void ThrowException(errorCodes code,const char* pErrorParameter1=NULL,const char* pErrorParameter2=NULL,const char* pErrorParameter3=NULL)
{
Logger pLogger;
pLogger.Open();
pLogger.Read((int)code);
/*File pFile("ErrorFile.log",1);
pFile.Open();
pFile.SetErrorFlag();
pFile.Write((pLogger.GetErrorString()).c_str(),pErrorParameter1,pErrorParameter2,pErrorParameter3);*/
pLogger.Open("ErrorFile.log",1);
pLogger.SetErrorFlag();
pLogger.Write((pLogger.GetErrorString()).c_str(),pErrorParameter1,pErrorParameter2,pErrorParameter3);
}
int _tmain(int argc, _TCHAR* argv[])
{
File pFile("log.txt",1);
pFile.Open();
char* buf="HI this is my sample programe";
pFile.Write(buf);
pFile.Close();
//just for checking whether the function is working or not
ThrowException(error_CannotOpenFile,"log.txt");
return 0;
}
|