Created
October 28, 2014 07:30
-
-
Save takumakei/7c2b282f0f9dc30721b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <iterator> | |
std::vector<char> read(const std::string& name) { | |
std::ifstream ifs(name, std::ios::in | std::ios::binary); | |
if (ifs.fail()) throw std::runtime_error("file not found"); | |
typedef std::istreambuf_iterator<char> itr; | |
return std::vector<char>(itr(ifs), itr()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment