-
Notifications
You must be signed in to change notification settings - Fork 0
/
shred_main.cpp
40 lines (36 loc) · 1.03 KB
/
shred_main.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
40
#include <iostream>
#include "text_shredder.h"
using namespace std;
#ifdef UTFLAG
int UTmain(const int n_width, const string str_infile, const string str_outfile)
#else
// Main function
int main()
#endif
{
try
{
#ifndef UTFLAG
// Provide letter width in each shredded strip, input file containing text for shredding, and
// output file to store shredded result.
TextShredder text_shredder(2, "full_text.ascii", "shredded_text.ascii");
#else
TextShredder text_shredder(n_width, str_infile, str_outfile);
#endif
// Populate vec_str_source_data_ from input file
text_shredder.GetInput();
// Shred text lines stored vec_str_source_data_ and save shredded result into vec_str_shredded_text_
text_shredder.DoTextShredder();
// Print vec_str_shredded_text_ to output file by delimiter "|"
text_shredder.CreateOutput();
}
catch(std::exception &ref_exception)
{
#ifndef UTFLAG
cout << ref_exception.what() << endl;
cout << "Error occured. Abort!" << endl;
#endif
return 1;
}
return 0;
}