12345
std::ifstream ifs("input.txt"); std::ofstream ofs("output.txt"); std::string buffer; while(std::getline(ifs, buffer)) ofs << buffer << std::endl; /* getline() doesn't read the newline, so we add it back to the output */