aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 6007d6b..bcaa0b1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,5 +1,24 @@
#include <iostream>
+#include <fstream>
+#include <streambuf>
+#include <string>
+
+std::string readFile(std::string& filename) {
+ std::ifstream t(filename);
+ std::string str((std::istreambuf_iterator<char>(t)),
+ (std::istreambuf_iterator<char>()));
+ return str;
+}
int main(int argc, char** argv) {
+ if (argc != 2) {
+ std::cout << "Please supply input file name as a parameter." << std::endl;
+ return 1;
+ }
+
+ std::string filename = std::string(argv[1]);
+ std::string input = readFile(filename);
+ std::cout << input;
+
return 0;
}