📄 processerrorapi.c
字号:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* File name : myapi.h *
* Module ID : *
* Module Name : *
* Purpose : A common api function called by other program to get
* sleep time between two procession *
* Author : Mr. Zhujingkun *
* Date Created : 1999,11,17 *
* Version : Version 1.0 *
* Environment : HP UX 11.0 *
* Portability : UNIX Platform *
* Warnings : *
* References : *
* Calling Syntax : *
* Parameters : None *
* Returns : void *
* Calling Function: *
* Called Functions: *
* Datastores and usages: * *
* (a) Input *
* (b) OutPut *
* Report : None *
* Screens : None *
* Messages Files : None *
* Change Log : *
* Change No. *
* Date *
* Author *
* Reason For Change *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
#include <stdio.h>
#include <stdlib.h>
#define ERROR_LOG_FILE "/usr/bkfx/log/errlog"
#define LOG_NORMAL "LOG_NORMAL "
#define LOG_ERROR "LOG_ERROR "
#define END ""
void ProcessError(const char *,const char *,const char *);
void ProcessError( const char* LOG, const char* sErrorMessage1,const char* sErrorMessage2 )
{
FILE* hErrorFile;
char cDateTime[100],tempstr[100];
int i;
for(i=0;i<100;i++)
{
if(sErrorMessage1[i]=='%')
{sErrorMessage1[i]=='\0';break;}
if(sErrorMessage1[i]=='\0')
break;
}
hErrorFile = fopen( ERROR_LOG_FILE, "a" );
if( hErrorFile == NULL )
{
printf( "Critical! Cannot open ERROR_LOG_FILE for append or cannot create!\n");
return;
}
fseek( hErrorFile, 0 ,SEEK_END );
fputs( "\n",hErrorFile);
fputs( LOG ,hErrorFile);
printf("\n%s",LOG);
fputs( sErrorMessage1,hErrorFile );
printf("%s",sErrorMessage1);
fputs( sErrorMessage2,hErrorFile );
printf("%s\n",sErrorMessage1);
fclose( hErrorFile );
sprintf( cDateTime, "date >> %s\n", ERROR_LOG_FILE );
system( cDateTime );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -