| 849 | |
| 850 | template <typename Stream> |
| 851 | void readFile(const std::string& file, Stream& os) { |
| 852 | std::ifstream ifs(file.c_str()); |
| 853 | if (ifs.fail()) |
| 854 | throw Rcpp::file_io_error(file); // #nocov |
| 855 | os << ifs.rdbuf(); |
| 856 | ifs.close(); |
| 857 | } |
| 858 | |
| 859 | template <typename Collection> |
| 860 | void readLines(std::istream& is, Collection* pLines) { |
no test coverage detected