ECF
1.5
D:
Projekt
ECF_trunk
examples
SRM
ReadData.h
1
#include<vector>
2
3
//
4
// reads delimited data from file; returns data as vector of vectors
5
//
6
template
<
class
T>
7
bool
readDataFromFile(std::vector< vector<T> >& data,
string
fileName)
8
{
9
ifstream file(fileName.c_str());
10
if
(!file)
11
return
false
;
12
13
data.clear();
14
string
line;
15
uint instance = 0;
16
17
while
(getline(file, line)) {
18
vector<T> set;
19
data.push_back(set);
20
stringstream ss(line);
21
T datum;
22
while
(ss >> datum)
23
data[instance].push_back(datum);
24
instance++;
25
}
26
27
return
true
;
28
}
Generated on Wed Aug 3 2022 17:50:43 for ECF by
1.9.4