-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
33 lines (28 loc) · 875 Bytes
/
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
#include <iostream>
#include "Include/Generator.h"
int main(int argc, char** argv) {
const char* usage = \
"Usage: \n"\
"./simplemdconverter <source_file> <converted_html_file>\n\n";
std::string inp_file_name;
std::string out_file_name;
auto set_args = [&]() {
if(argc != 3) {
std::cerr << "Incorrect number of arguments supplied" << std::endl;
std::cout << usage;
exit(1);
}
FILE* check = fopen(argv[1], "r");
if(check == nullptr) {
std::cerr << "Source file cannot be read" << std::endl;
std::cout << usage;
fclose(check);
exit(1);
}
fclose(check);
inp_file_name = argv[1];
out_file_name = argv[2];
};
set_args();
simplemdconverter::Generator::convert(inp_file_name, out_file_name);
}