-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventLib.cpp
41 lines (38 loc) · 1.11 KB
/
eventLib.cpp
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
/*
* =========================================================================================
* Name : eventLib.cpp
* Author : Duc Dung Nguyen, Nguyen Hoang Minh
* Email : [email protected]
* Copyright : Faculty of Computer Science and Engineering - Bach Khoa University
* Description : library for Assignment 1 - Data structures and Algorithms - Fall 2017
* This library contains functions used for event management
* =========================================================================================
*/
#include "eventLib.h"
/// NOTE: each event will be separated by spaces, or endline character
void loadEvents(char* fName, L1List<ninjaEvent_t> &eList) {
//TODO
fstream inF(fName);
if (!inF)
{
cerr << "\nCannot open the file for reading!\n";
return;
}
else
{
string str;
stringstream buf;
getline(inF, str, ';');
inF.close();
buf << str;
ninjaEvent n;
while (!buf.eof())
{
buf >> str;
strncpy(n.code, str.c_str(), EVENT_CODE_SIZE - 1);
str.clear();
eList.push_back(n);
}
}
return;
}