-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.cpp
More file actions
49 lines (31 loc) · 645 Bytes
/
Copy pathbase.cpp
File metadata and controls
49 lines (31 loc) · 645 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "base.h"
#include<stdio.h>
#include<string.h>
int Base::Count = 0;
char Base::LogFile[256] = {0};
//call constructor
Base::Base()
{
if(!LogFile[0]) strcpy(LogFile,"Output.log");
Count++;
sprintf(Msg,"> %d instance(s) created\n",Count);
AppendLog(Msg);
}
Base::~Base()
{
Count--;
sprintf(Msg,"> %d instance(s) available\n",Count);
AppendLog(Msg);
}
int Base::AppendLog(char* pStr)
{
printf("%s",pStr);
FILE* fileptr = fopen(LogFile,"a");
if(fileptr)
{
fprintf(fileptr,"%s",pStr);
fclose(fileptr);
return 1;
}
return 0;
}