aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
blob: bcaa0b1df3cc11fad5f5427f9230dc503b1daa7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}