-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremix.cpp
More file actions
33 lines (32 loc) · 923 Bytes
/
Copy pathremix.cpp
File metadata and controls
33 lines (32 loc) · 923 Bytes
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 <fstream>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdlib>
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/replace.hpp>
using namespace std;
using namespace boost;
int main(int argc, char const *argv[]) {
if (argc > 1) {
ifstream infile (argv[1]);
stringstream filebuf;
filebuf << infile.rdbuf();
ifstream stdlibfile ("remix-stdlib.cpp");
stringstream rstdlib;
rstdlib << stdlibfile.rdbuf();
string outstr = "";
outstr += filebuf.str();
replace_all(outstr, "str ", "string ");
replace_all(outstr, "imain", "int main (int argc, char const *argv[]){\n");
outstr = rstdlib.str() + outstr;
ofstream outfile ("remix.out.cpp");
outfile << outstr;
outfile.close();
system("g++ remix.out.cpp -o remix.out");
} else {
cout << "Remix: Not Enough Arguments" << endl;
}
return 0;
}