-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequestLib.cpp
39 lines (37 loc) · 1.02 KB
/
requestLib.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
/*
* =========================================================================================
* Name : eventLib.cpp
* Author : Duc Dung Nguyen
* Email : [email protected]
* Copyright : Faculty of Computer Science and Engineering - Bach Khoa University
* Description : library for Assignment 2 - Data structures and Algorithms - Fall 2017
* This library contains functions used for event management
* =========================================================================================
*/
#include "requestLib.h"
void loadRequests(char* fName, L1List<VM_Request> &rList) {
// TODO: write your code to load requests. Each request is separated by a whitespace
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;
VM_Request n;
while (!buf.eof())
{
buf >> str;
n.code = str;
str.clear();
rList.push_back(n);
}
}
return;
}