-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalign.cpp
32 lines (28 loc) · 809 Bytes
/
align.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
/// \file
/// \brief The tool for aligning output of several invocations of the framework.
/// \author Meir Goldenberg
#include "outside_headers.h"
#include "core/util/stream.h"
#include "core/util/container.h"
#include "core/util/string.h"
#include "core/util/table.h"
using namespace slb::core::util;
/// The main function.
int main(int argc, char **argv) {
if (argc < 2)
throw std::invalid_argument("File name is not specified");
std::ifstream fin(argv[1]);
if (!fin)
throw std::invalid_argument("Could not open the file");
std::string line;
Table t;
while (std::getline(fin, line)) {
std::string s;
while ((s = stuff(line)) != "")
t << s;
t << std::endl;
}
std::ofstream fout(argv[1]);
fout << t;
return 0;
}