// [[Rcpp::export]] void write_file_raw_(RawVector x, const std::string &path, bool append = false) { std::ofstream output(path.c_str(), append ? std::ofstream::app : std::ofstream::trunc); if (output.fail()) { stop("Failed to open '%s'.", path); } std::copy(x.begin(), x.end(), std::ostream_iterator<char>(output)); return; }