-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.cpp
More file actions
53 lines (46 loc) · 1.05 KB
/
Copy pathtemplate.cpp
File metadata and controls
53 lines (46 loc) · 1.05 KB
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
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
std::pair<int,int> operator+(std::pair<int,int> lhs, std::pair<int,int> rhs)
{
return {lhs.first+rhs.first,lhs.second+rhs.second};
}
std::vector<std::string> splitLine(std::string line, std::string split = " ")
{
std::vector<std::string> vectorOfStrings;
std::size_t indx = 0;
std::size_t newIndx = 0;
while(newIndx != std::string::npos && (indx < line.length()))
{
newIndx = line.find(split, indx);
if((newIndx - indx) > 0)
{
vectorOfStrings.push_back(line.substr(indx, newIndx - indx));
}
indx = newIndx + split.size();
}
return vectorOfStrings;
}
int main(int argc, char const *argv[])
{
std::ifstream myfile;
std::string line;
if (argc > 1)
{
myfile.open(argv[1]);
}
else
{
return -1;
}
if (myfile.is_open())
{
while(getline(myfile,line))
{
}
}
myfile.close();
}