File input/output: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 148: | Line 148: | ||
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
||
} |
|||
Using istream- and ostream- iterators: |
|||
# include <algorithm> |
|||
# include <fstream> |
|||
int main() { |
|||
std::ifstream ifile("input.txt"); |
|||
std::ofstream ofile("output.txt"); |
|||
std::copy(std::istreambuf_iterator<char>(ifile), |
|||
std::istreambuf_iterator<char>(), |
|||
std::ostreambuf_iterator<char>(ofile)); |
|||
} |
} |
||