blob: 87d90875f2aa69874bd28599d7fc7eee1c1f2ff5 (
plain) (
blame)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Implementation of CEventList
//
// $Workfile: $
// $Date: $
//
//------------------------------------------------------------------------------------------------------
// $Log: $
//
// $NoKeywords: $
//=============================================================================//
#include <stdlib.h>
#include "TFStatsApplication.h"
#include "EventList.h"
#include "memdbg.h"
#pragma warning (disable : 4786)
//------------------------------------------------------------------------------------------------------
// Function: CEventList::readEventList
// Purpose: reads and returns a CEventList from a logfile
// Input: filename - the logfile to read from
// Output: CEventList*
//------------------------------------------------------------------------------------------------------
CEventList* CEventList::readEventList(const char* filename)
{
// ifstream ifs(filename);
CEventList* plogfile=new TRACKED CEventList();
if (!plogfile)
{
printf("TFStats ran out of memory!\n");
return NULL;
}
FILE* f=fopen(filename,"rt");
if (!f)
g_pApp->fatalError("Error opening %s, please make sure that the file exists and is not being accessed by other processes",filename);
while (!feof(f))
{
CLogEvent* curr=NULL;
curr=new TRACKED CLogEvent(f);
if (!curr->isValid())
{
delete curr;
break;//eof reached
}
plogfile->insert(plogfile->end(),curr);
}
fclose(f);
#ifndef WIN32
chmod(filename,PERMIT);
#endif
return plogfile;
}
|