-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread.cpp
More file actions
33 lines (27 loc) · 881 Bytes
/
Copy pathread.cpp
File metadata and controls
33 lines (27 loc) · 881 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
#include "include_lib.h"
bool read(std::string File, std::vector<Processo>& processList ){
processList.clear();
std::vector<std::string> Content;
std::string temp;
std::ifstream channel;
Processo * temp_proc;
channel.open(File);
if(channel.is_open()){
while(!channel.eof()){
while(channel >> temp or !channel.eof()){
Content.push_back(temp);
if(Content.size() == 4){
temp_proc = new Processo (Content.at(0), Content.at(1), Content.at(2), Content.at(3));
processList.push_back(*temp_proc);
Content.clear();
}
}
if(temp == "\0") std::getline(channel,temp);
}
return true;
}
else{
std::cout << "Houston, we've a problem!" << std::endl;
return false;
}
}